Пример #1
0
 /**
  * Create the toolbar. By default this reads the resource file for the definition of the toolbar.
  */
 private Component createToolbar() {
   toolbar = new JToolBar();
   String[] toolKeys = SCSUtility.tokenize(getResourceString("toolbar"));
   for (int i = 0; i < toolKeys.length; i++) {
     if (toolKeys[i].equals("-")) {
       toolbar.add(Box.createHorizontalStrut(5));
     } else {
       toolbar.add(createTool(toolKeys[i]));
     }
   }
   toolbar.add(Box.createHorizontalGlue());
   return toolbar;
 }
Пример #2
0
 /**
  * Create a menu for the app. By default this pulls the definition of the menu from the associated
  * resource file.
  */
 protected JMenu createMenu(String key) {
   String[] itemKeys = SCSUtility.tokenize(getResourceString(key));
   JMenu menu = new JMenu(getResourceString(key + "Label"));
   for (int i = 0; i < itemKeys.length; i++) {
     if (itemKeys[i].equals("-")) {
       menu.addSeparator();
     } else {
       // System.out.println("Debug:TextViewer:itemkey: "+itemKeys[i]);
       JMenuItem mi = createMenuItem(itemKeys[i]);
       menu.add(mi);
     }
   }
   return menu;
 }
Пример #3
0
  /**
   * Create the menubar for the app. By default this pulls the definition of the menu from the
   * associated resource file.
   */
  protected JMenuBar createMenubar() {
    JMenuItem mi;
    JMenuBar mb = new JMenuBar();

    String[] menuKeys = SCSUtility.tokenize(getResourceString("menubar"));
    // System.out.println("TextViewer:menuKeys.length "+menuKeys.length);
    for (int i = 0; i < menuKeys.length; i++) {
      JMenu m = createMenu(menuKeys[i]);
      if (m != null) {
        mb.add(m);
      }
    }
    return mb;
  }