+
+ statusBar = newStatusBar("Demo Main Window");
+ statusBar.addShortcutKeypress(kbF1, cmHelp, "Help");
+ statusBar.addShortcutKeypress(kbF2, cmShell, "Shell");
+ statusBar.addShortcutKeypress(kbF3, cmOpen, "Open");
+ statusBar.addShortcutKeypress(kbF10, cmExit, "Exit");
+ }
+
+ /**
+ * Method that subclasses can override to handle posted command events.
+ *
+ * @param command command event
+ */
+ @Override
+ public void onCommand(final TCommandEvent command) {
+ if (command.equals(cmOpen)) {
+ try {
+ String filename = fileOpenBox(".");
+ if (filename != null) {
+ try {
+ new TEditorWindow(getApplication(), new File(filename));
+ } catch (IOException e) {
+ messageBox("Error", "Error reading file: " +
+ e.getMessage());
+ }
+ }
+ } catch (IOException e) {
+ messageBox("Error", "Error opening file dialog: " +
+ e.getMessage());
+ }
+ return;
+ }
+
+ // Didn't handle it, let children get it instead
+ super.onCommand(command);