X-Git-Url: http://git.nikiroo.be/?a=blobdiff_plain;f=src%2Fjexer%2FTApplication.java;h=4c55aad9a70f20f83d63fdfb49e9b6b5df8c0e9f;hb=87a17f3ca4b2602c396afdbb13cccb4c1e7cbd38;hp=f4b79970b30609a59fdd2682eeb7fd3ba1e875ec;hpb=c6940ed922d1c4e06bf30fd57a50e43f0720e60c;p=nikiroo-utils.git diff --git a/src/jexer/TApplication.java b/src/jexer/TApplication.java index f4b7997..4c55aad 100644 --- a/src/jexer/TApplication.java +++ b/src/jexer/TApplication.java @@ -51,6 +51,7 @@ import jexer.event.TMenuEvent; 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; @@ -311,7 +312,26 @@ public class TApplication { 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(); @@ -481,7 +501,9 @@ public class TApplication { doIdle(); // Update the screen - drawAll(); + synchronized (getScreen()) { + drawAll(); + } } // Shutdown the consumer threads @@ -1267,7 +1289,7 @@ public class TApplication { * @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); @@ -1506,5 +1528,5 @@ public class TApplication { return new TInputBox(this, title, caption, text); } - + }