mirror of
https://gitlab.com/AutumnMeowMeow/jexer
synced 2024-09-19 11:50:19 -06:00
Expose fontSize for Swing backend in main Demo
This commit is contained in:
parent
ce0d379497
commit
0bbc76e7d9
2 changed files with 36 additions and 1 deletions
|
@ -59,7 +59,21 @@ public class Demo1 {
|
||||||
backendType = TApplication.BackendType.XTERM;
|
backendType = TApplication.BackendType.XTERM;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
DemoApplication app = new DemoApplication(backendType);
|
DemoApplication app;
|
||||||
|
if (backendType == TApplication.BackendType.SWING) {
|
||||||
|
int fontSize = 20;
|
||||||
|
try {
|
||||||
|
fontSize = Integer.parseInt(
|
||||||
|
System.getProperty("jexer.Swing.fontSize", "20"));
|
||||||
|
// Keep requested font size between 16 and 32 pt.
|
||||||
|
fontSize = Math.min(32, Math.max(16, fontSize));
|
||||||
|
} catch (NumberFormatException e) {
|
||||||
|
// SQUASH
|
||||||
|
}
|
||||||
|
app = new DemoApplication(backendType, 90, 30, fontSize);
|
||||||
|
} else {
|
||||||
|
app = new DemoApplication(backendType);
|
||||||
|
}
|
||||||
(new Thread(app)).start();
|
(new Thread(app)).start();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
|
|
@ -156,6 +156,27 @@ public class DemoApplication extends TApplication {
|
||||||
onMenu(new TMenuEvent(getBackend(), 10001));
|
onMenu(new TMenuEvent(getBackend(), 10001));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Public constructor.
|
||||||
|
*
|
||||||
|
* @param backendType one of the TApplication.BackendType values
|
||||||
|
* @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
|
||||||
|
* @throws Exception if TApplication can't instantiate the Backend.
|
||||||
|
*/
|
||||||
|
@SuppressWarnings("this-escape")
|
||||||
|
public DemoApplication(final BackendType backendType, final int windowWidth,
|
||||||
|
final int windowHeight, final int fontSize) throws Exception {
|
||||||
|
|
||||||
|
super(backendType, windowWidth, windowHeight, fontSize);
|
||||||
|
addAllWidgets();
|
||||||
|
getBackend().setTitle(i18n.getString("applicationTitle"));
|
||||||
|
|
||||||
|
// Use cute theme by default.
|
||||||
|
onMenu(new TMenuEvent(getBackend(), 10001));
|
||||||
|
}
|
||||||
|
|
||||||
// ------------------------------------------------------------------------
|
// ------------------------------------------------------------------------
|
||||||
// TApplication -----------------------------------------------------------
|
// TApplication -----------------------------------------------------------
|
||||||
// ------------------------------------------------------------------------
|
// ------------------------------------------------------------------------
|
||||||
|
|
Loading…
Reference in a new issue