git://git.nikiroo.be
/
nikiroo-utils.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
#16 expose columns, rows, font size
[nikiroo-utils.git]
/
src
/
jexer
/
io
/
SwingScreen.java
diff --git
a/src/jexer/io/SwingScreen.java
b/src/jexer/io/SwingScreen.java
index 24b007a3040cf1a79db1d6d146e2ee0138025b38..ee8467dd076008970784d1225609f516cbc9a469 100644
(file)
--- a/
src/jexer/io/SwingScreen.java
+++ b/
src/jexer/io/SwingScreen.java
@@
-308,8
+308,10
@@
public final class SwingScreen extends Screen {
* Public constructor.
*
* @param screen the Screen that Backend talks to
* Public constructor.
*
* @param screen the Screen that Backend talks to
+ * @param fontSize the size in points. Good values to pick are: 16,
+ * 20, 22, and 24.
*/
*/
- public SwingFrame(final SwingScreen screen) {
+ public SwingFrame(final SwingScreen screen
, final int fontSize
) {
this.screen = screen;
setDOSColors();
this.screen = screen;
setDOSColors();
@@
-342,13
+344,13
@@
public final class SwingScreen extends Screen {
getContextClassLoader();
InputStream in = loader.getResourceAsStream(FONTFILE);
Font terminusRoot = Font.createFont(Font.TRUETYPE_FONT, in);
getContextClassLoader();
InputStream in = loader.getResourceAsStream(FONTFILE);
Font terminusRoot = Font.createFont(Font.TRUETYPE_FONT, in);
- Font terminus = terminusRoot.deriveFont(Font.PLAIN,
20
);
+ Font terminus = terminusRoot.deriveFont(Font.PLAIN,
fontSize
);
setFont(terminus);
gotTerminus = true;
} catch (Exception e) {
e.printStackTrace();
// setFont(new Font("Liberation Mono", Font.PLAIN, 24));
setFont(terminus);
gotTerminus = true;
} catch (Exception e) {
e.printStackTrace();
// setFont(new Font("Liberation Mono", Font.PLAIN, 24));
- setFont(new Font(Font.MONOSPACED, Font.PLAIN,
24
));
+ setFont(new Font(Font.MONOSPACED, Font.PLAIN,
fontSize
));
}
pack();
}
pack();
@@
-742,16
+744,24
@@
public final class SwingScreen extends Screen {
/**
* Public constructor.
/**
* Public constructor.
+ *
+ * @param windowWidth the number of text columns to start with
+ * @param windowHeight the number of text rows to start with
+ * @param fontSize the size in points. Good values to pick are: 16, 20,
+ * 22, and 24.
*/
*/
- public SwingScreen() {
+ public SwingScreen(final int windowWidth, final int windowHeight,
+ final int fontSize) {
+
try {
SwingUtilities.invokeAndWait(new Runnable() {
public void run() {
try {
SwingUtilities.invokeAndWait(new Runnable() {
public void run() {
- SwingScreen.this.frame = new SwingFrame(SwingScreen.this);
+ SwingScreen.this.frame = new SwingFrame(SwingScreen.this,
+ fontSize);
SwingScreen.this.sessionInfo =
new SwingSessionInfo(SwingScreen.this.frame,
SwingScreen.this.sessionInfo =
new SwingSessionInfo(SwingScreen.this.frame,
- frame.textWidth,
-
frame.text
Height);
+ frame.textWidth,
frame.textHeight,
+
windowWidth, window
Height);
SwingScreen.this.setDimensions(sessionInfo.getWindowWidth(),
sessionInfo.getWindowHeight());
SwingScreen.this.setDimensions(sessionInfo.getWindowWidth(),
sessionInfo.getWindowHeight());