Exemple #1
0
 public void addMenu(JMenu jMenu, String string) {
   int n = -1;
   JMenu jMenu2 = (JMenu) this.menus.get(string);
   if (jMenu2 == null) {
     return;
   }
   if (string.equals("Edit")) {
     n = 13 + this.editMenusAdded;
     ++this.editMenusAdded;
   } else if (string.equals("File")) {
     n = 22 + this.fileMenusAdded;
     ++this.fileMenusAdded;
   }
   if (n == -1) {
     if (!(jMenu2.getMenuComponent(jMenu2.getItemCount() - 2) instanceof JSeparator)) {
       if (Jext.getFlatMenus()) {
         jMenu2.getPopupMenu().add(new JextMenuSeparator());
       } else {
         jMenu2.getPopupMenu().addSeparator();
       }
     }
     jMenu2.add(jMenu);
   } else {
     jMenu2.insert(jMenu, n);
   }
   JextFrame jextFrame = this.getJextFrame();
   if (jextFrame != null) {
     jextFrame.itemAdded(jMenu);
   }
 }
Exemple #2
0
 public void addIdentifiedMenu(JMenu jMenu, String string) {
   if (this.menus.containsKey(string)) {
     System.err.println("JextMenuBar: There is already a menu with ID '" + string + "'!");
   }
   this.menus.put(string, jMenu);
   this.add(jMenu);
   JextFrame jextFrame = this.getJextFrame();
   if (jextFrame != null) {
     jextFrame.itemAdded(jMenu);
   }
 }