import jexer.event.TMouseEvent;
import jexer.event.TResizeEvent;
import jexer.backend.Backend;
+import jexer.backend.AWTBackend;
import jexer.backend.ECMA48Backend;
import jexer.io.Screen;
import jexer.menu.TMenu;
public TApplication(final InputStream input,
final OutputStream output) throws UnsupportedEncodingException {
- backend = new ECMA48Backend(input, output);
+ // AWT is the default backend on Windows unless explicitly overridden
+ // by jexer.AWT.
+ boolean useAWT = false;
+ if (System.getProperty("os.name").startsWith("Windows")) {
+ useAWT = true;
+ }
+ if (System.getProperty("jexer.AWT") != null) {
+ if (System.getProperty("jexer.AWT", "false").equals("true")) {
+ useAWT = true;
+ } else {
+ useAWT = false;
+ }
+ }
+
+
+ if (useAWT) {
+ backend = new AWTBackend();
+ } else {
+ backend = new ECMA48Backend(input, output);
+ }
theme = new ColorTheme();
desktopBottom = getScreen().getHeight() - 1;
fillEventQueue = new ArrayList<TInputEvent>();
doIdle();
// Update the screen
- drawAll();
+ synchronized (getScreen()) {
+ drawAll();
+ }
}
// Shutdown the consumer threads
* @param title menu title
* @return the new menu
*/
- public final TMenu addMenu(String title) {
+ public final TMenu addMenu(final String title) {
int x = 0;
int y = 0;
TMenu menu = new TMenu(this, x, y, title);
return new TInputBox(this, title, caption, text);
}
-
+
}