+ getBackend().setTitle(i18n.getString("applicationTitle"));
+ }
+
+ // ------------------------------------------------------------------------
+ // TApplication -----------------------------------------------------------
+ // ------------------------------------------------------------------------
+
+ /**
+ * Handle menu events.
+ *
+ * @param menu menu event
+ * @return if true, the event was processed and should not be passed onto
+ * a window
+ */
+ @Override
+ public boolean onMenu(final TMenuEvent menu) {
+
+ if (menu.getId() == 3000) {
+ // Bigger +2
+ assert (getScreen() instanceof SwingTerminal);
+ SwingTerminal terminal = (SwingTerminal) getScreen();
+ terminal.setFontSize(terminal.getFontSize() + 2);
+ return true;
+ }
+ if (menu.getId() == 3001) {
+ // Smaller -2
+ assert (getScreen() instanceof SwingTerminal);
+ SwingTerminal terminal = (SwingTerminal) getScreen();
+ terminal.setFontSize(terminal.getFontSize() - 2);
+ return true;
+ }
+
+ if (menu.getId() == 2050) {
+ new TEditColorThemeWindow(this);
+ return true;
+ }
+
+ if (menu.getId() == TMenu.MID_OPEN_FILE) {
+ try {
+ String filename = fileOpenBox(".");
+ if (filename != null) {
+ try {
+ new TEditorWindow(this, new File(filename));
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ return true;
+ }
+ return super.onMenu(menu);
+ }
+
+ // ------------------------------------------------------------------------
+ // DemoApplication --------------------------------------------------------
+ // ------------------------------------------------------------------------
+
+ /**
+ * Add all the widgets of the demo.
+ */
+ private void addAllWidgets() {
+ new DemoMainWindow(this);
+
+ // Add the menus
+ addToolMenu();
+ addFileMenu();
+ addEditMenu();
+
+ TMenu demoMenu = addMenu(i18n.getString("demo"));
+ TMenuItem item = demoMenu.addItem(2000, i18n.getString("checkable"));
+ item.setCheckable(true);
+ item = demoMenu.addItem(2001, i18n.getString("disabled"));
+ item.setEnabled(false);
+ item = demoMenu.addItem(2002, i18n.getString("normal"));
+ TSubMenu subMenu = demoMenu.addSubMenu(i18n.getString("subMenu"));
+ item = demoMenu.addItem(2010, i18n.getString("normal"));
+ item = demoMenu.addItem(2050, i18n.getString("colors"));
+
+ item = subMenu.addItem(2000, i18n.getString("checkableSub"));
+ item.setCheckable(true);
+ item = subMenu.addItem(2001, i18n.getString("disabledSub"));
+ item.setEnabled(false);
+ item = subMenu.addItem(2002, i18n.getString("normalSub"));
+
+ subMenu = subMenu.addSubMenu(i18n.getString("subMenu"));
+ item = subMenu.addItem(2000, i18n.getString("checkableSub"));
+ item.setCheckable(true);
+ item = subMenu.addItem(2001, i18n.getString("disabledSub"));
+ item.setEnabled(false);
+ item = subMenu.addItem(2002, i18n.getString("normalSub"));
+
+ if (getScreen() instanceof SwingTerminal) {
+ TMenu swingMenu = addMenu(i18n.getString("swing"));
+ item = swingMenu.addItem(3000, i18n.getString("bigger"));
+ item = swingMenu.addItem(3001, i18n.getString("smaller"));
+ }
+
+ addTableMenu();
+ addWindowMenu();
+ addHelpMenu();