- public void read() throws IOException {
- if (getStory() == null) {
- throw new IOException("No story to read");
+ /**
+ * Will detect the backend to use.
+ * <p>
+ * Swing is the default backend on Windows and MacOS while evreything else
+ * will use XTERM unless explicitly overridden by <tt>jexer.Swing</tt> =
+ * <tt>true</tt> or <tt>false</tt>.
+ *
+ * @return the backend to use
+ */
+ private static BackendType guessBackendType() {
+ // TODO: allow a config option to force one or the other?
+ TApplication.BackendType backendType = TApplication.BackendType.XTERM;
+ if (System.getProperty("os.name").startsWith("Windows")) {
+ backendType = TApplication.BackendType.SWING;
+ }
+
+ if (System.getProperty("os.name").startsWith("Mac")) {
+ backendType = TApplication.BackendType.SWING;
+ }
+
+ if (System.getProperty("jexer.Swing") != null) {
+ if (System.getProperty("jexer.Swing", "false").equals("true")) {
+ backendType = TApplication.BackendType.SWING;
+ } else {
+ backendType = TApplication.BackendType.XTERM;
+ }