Beispiel #1
0
 private void setListeners() {
   // Regular items
   openItem.addActionListener(controller);
   exitItem.addActionListener(controller);
   connectItem.addActionListener(controller);
   disconnectItem.addActionListener(controller);
   reconnectItem.addActionListener(controller);
   resetItem.addActionListener(controller);
   // Checkboxes
   perspectiveItem.addActionListener(controller);
   sideViewitem.addActionListener(controller);
   topViewItem.addActionListener(controller);
   showGridItem.addActionListener(controller);
   // Radios
   layoutItem1.addActionListener(controller);
   layoutItem2.addActionListener(controller);
   layoutItem3.addActionListener(controller);
   layoutItem4.addActionListener(controller);
   // And more regular items
   settingsItem.addActionListener(controller);
   modeItem1.addActionListener(controller);
   modeItem2.addActionListener(controller);
   helpItem.addActionListener(controller);
   aboutItem.addActionListener(controller);
 }
  public void createPopupMenu() {
    super.createPopupMenu();

    JPopupMenu popupMenu = getPopupMenu();
    if (popupMenu == null) {
      popupMenu = new JPopupMenu();
      setPopupMenu(popupMenu);
    } else {
      popupMenu.addSeparator();
    }

    propertiesItem = new JMenuItem("Properties ...");

    propertiesItem.addActionListener(this);
    propertiesItem.setMnemonic('s');
    popupMenu.add(propertiesItem);

    popupMenu.addSeparator();
    ButtonGroup group = new ButtonGroup();
    inItem = new JRadioButtonMenuItem("IN");
    group.add(inItem);
    inItem.addActionListener(this);
    popupMenu.add(inItem);
    outItem = new JRadioButtonMenuItem("OUT");
    group.add(outItem);
    outItem.addActionListener(this);
    popupMenu.add(outItem);
    inoutItem = new JRadioButtonMenuItem("INOUT");
    group.add(inoutItem);
    inoutItem.addActionListener(this);
    popupMenu.add(inoutItem);
  }
  /** Builds the MenuBar */
  private void buildUI() {
    // Construct menu items
    JMenu lookAndFeel = new JMenu("Look and feel");
    JRadioButtonMenuItem nativeLaF = new JRadioButtonMenuItem("Native", true);
    JRadioButtonMenuItem javaLaF = new JRadioButtonMenuItem("Java (Metal)");
    JRadioButtonMenuItem motifLaF = new JRadioButtonMenuItem("Motif");
    JMenu help = new JMenu("Help");
    JMenuItem about = new JMenuItem("About");

    // Add menu items to menu bar
    add(lookAndFeel);
    lookAndFeel.add(nativeLaF);
    lookAndFeel.add(javaLaF);
    lookAndFeel.add(motifLaF);
    add(Box.createHorizontalGlue());
    add(help);
    help.add(about);

    // Add buttons to button group
    ButtonGroup laFGroup = new ButtonGroup();
    laFGroup.add(nativeLaF);
    laFGroup.add(javaLaF);
    laFGroup.add(motifLaF);

    // Set action listeners
    nativeLaF.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            UIUtilities.setLookAndFeel(owner, UIManager.getSystemLookAndFeelClassName());
            owner.pack();
          }
        });

    javaLaF.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            UIUtilities.setLookAndFeel(owner, UIManager.getCrossPlatformLookAndFeelClassName());
            owner.pack();
          }
        });

    motifLaF.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            UIUtilities.setLookAndFeel(owner, "com.sun.java.swing.plaf.motif.MotifLookAndFeel");
            owner.pack();
          }
        });

    about.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            UIUtilities.showAboutDialog(owner);
          }
        });
  }
    public JComponent[] getMenuPresenters() {
      assert SwingUtilities.isEventDispatchThread() : "Must be called from AWT";
      removeAll();
      final TopComponent tc = WindowManager.getDefault().getRegistry().getActivated();
      if (tc != null) {
        setEnabled(true);
        MultiViewHandler handler = MultiViews.findMultiViewHandler(tc);
        if (handler != null) {
          ButtonGroup group = new ButtonGroup();
          MultiViewPerspective[] pers = handler.getPerspectives();
          final String[] names = new String[pers.length];
          for (int i = 0; i < pers.length; i++) {
            MultiViewPerspective thisPers = pers[i];

            JRadioButtonMenuItem item = new JRadioButtonMenuItem();
            names[i] = thisPers.getDisplayName();
            Mnemonics.setLocalizedText(item, thisPers.getDisplayName());
            item.setActionCommand(thisPers.getDisplayName());
            item.addActionListener(
                new ActionListener() {
                  public void actionPerformed(ActionEvent event) {
                    MultiViewHandler handler = MultiViews.findMultiViewHandler(tc);
                    if (handler == null) {
                      return;
                    }
                    MultiViewPerspective thisPers = null;
                    MultiViewPerspective[] pers = handler.getPerspectives();
                    assert pers.length == names.length : "Arrays must have the same length";
                    for (int i = 0; i < pers.length; i++) {
                      if (event.getActionCommand().equals(names[i])) {
                        thisPers = pers[i];
                        break;
                      }
                    }
                    if (thisPers != null) {
                      handler.requestActive(thisPers);
                    }
                  }
                });
            if (thisPers
                .getDisplayName()
                .equals(handler.getSelectedPerspective().getDisplayName())) {
              item.setSelected(true);
            }
            group.add(item);
            add(item);
          }
        } else { // handler == null
          // No reason to enable action on any TC because now it was enabled even for Welcome page
          setEnabled(false);
          /*JRadioButtonMenuItem but = new JRadioButtonMenuItem();
          Mnemonics.setLocalizedText(but, NbBundle.getMessage(EditorsAction.class, "EditorsAction.source"));
          but.setSelected(true);
          add(but);*/
        }
      } else { // tc == null
        setEnabled(false);
      }
      return new JComponent[] {this};
    }
Beispiel #5
0
  /**
   * Loads the menu with the available look and feels for the application
   *
   * @return l and f menu
   */
  JMenu buildLookAndFeelMenu() {
    String activeLookAndFeelName = UIManager.getLookAndFeel().getName();

    // ButtonGroup buttonGroup = new ButtonGroup();
    JMenu lfMenu = new JMenu();

    lfMenu.setText(rb.getString("Menu.LookAndFeel.Name"));
    lfMenu.setMnemonic(jgnash.ui.util.Resource.getMnemonic("Menu.LookAndFeel.Mnemonic"));

    lfMenu.add(buildSubstanceMenu());

    List<String> lookAndFeels = new ArrayList<>();

    for (LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) {
      if (isLookAndFeelAvailable(info.getClassName())) {
        lookAndFeels.add(info.getClassName());
      }
    }

    for (String lookAndFeel : KNOWN) {
      if (isLookAndFeelAvailable(lookAndFeel)) {
        lookAndFeels.add(lookAndFeel);
      }
    }

    Collections.sort(lookAndFeels);

    for (String lookAndFeel : lookAndFeels) {
      try {
        Class<?> lnfClass = Class.forName(lookAndFeel);
        LookAndFeel newLAF = (LookAndFeel) lnfClass.newInstance();

        JRadioButtonMenuItem button = new JRadioButtonMenuItem();

        button.setText(newLAF.getName());
        button.setActionCommand(lookAndFeel);
        button.setName(newLAF.getName());

        button.addActionListener(
            e -> {
              Preferences pref = Preferences.userNodeForPackage(ThemeManager.class);
              pref.put(LF, e.getActionCommand());

              restartUI();
            });

        lfButtonGroup.add(button);

        lfMenu.add(button);

        if (newLAF.getName().equals(activeLookAndFeelName)) {
          button.setSelected(true);
        }
      } catch (ClassNotFoundException | InstantiationException | IllegalAccessException e) {
        Logger.getLogger(ThemeManager.class.getName()).log(Level.WARNING, null, e);
      }
    }

    return lfMenu;
  }
  /** Return a menu for DesktopWindow and add a special listener. */
  public static JMenu getCurrencyMenu(ActionListener listener) {
    JRadioButtonMenuItem menuItem;
    String defaultCurrency = Money.getCurrencyFor(Money.getDefaultCurrency());

    JMenu menu = new JMenu("Währung");
    ButtonGroup group = new ButtonGroup();

    JMenu europeanMenu = new JMenu("Europa");
    String europeanCurrencies[] = Money.getEuropeanCurrencyList();

    for (int i = 0; i < europeanCurrencies.length; i++) {
      menuItem = new RadioCurrencyMenuItem(europeanCurrencies[i]);
      menuItem.addActionListener(listener);
      europeanMenu.add(menuItem);

      group.add(menuItem);

      if (europeanCurrencies[i].startsWith(defaultCurrency)) {
        menuItem.setSelected(true);
      }

      if (i == 0) {
        europeanMenu.addSeparator();
      }
    }

    menu.add(europeanMenu);

    return menu;
  }
 public TreeElementMenu(
     MainFrame _frame,
     TopiaryWindow _parent,
     String name,
     ColorPanel _colorPanel,
     int elementType) {
   super(name);
   parent = _parent;
   frame = _frame;
   tree = ((TreeWindow) parent).tree;
   noColoringMenuItem.addActionListener(this);
   add(noColoringMenuItem);
   majorityColoringMenuItem.addActionListener(this);
   add(majorityColoringMenuItem);
   colorBy = new ColorByMenu(frame, parent, _colorPanel, elementType);
   add(colorBy);
 }
  protected JMenu buildSpeedMenu() {
    JMenu speed = new JMenu("Drag");

    JRadioButtonMenuItem live = new JRadioButtonMenuItem("Live");
    JRadioButtonMenuItem outline = new JRadioButtonMenuItem("Outline");

    JRadioButtonMenuItem slow = new JRadioButtonMenuItem("Old and Slow");

    ButtonGroup group = new ButtonGroup();

    group.add(live);
    group.add(outline);
    group.add(slow);

    live.setSelected(true);

    slow.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            // for right now I'm saying if you set the mode
            // to something other than a specified mode
            // it will revert to the old way
            // This is mostly for comparison's sake
            desktop.setDragMode(-1);
          }
        });

    live.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            desktop.setDragMode(JDesktopPane.LIVE_DRAG_MODE);
          }
        });

    outline.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            desktop.setDragMode(JDesktopPane.OUTLINE_DRAG_MODE);
          }
        });

    speed.add(live);
    speed.add(outline);
    speed.add(slow);
    return speed;
  }
 public void addRadioMenuItem(String name, String eventName, boolean isSelected) {
   JRadioButtonMenuItem newItem = new JRadioButtonMenuItem(name);
   newItem.addActionListener(this);
   if (isSelected == true) {
     newItem.setSelected(true);
   }
   this.currentButtonGroup.add(newItem);
   this.currentMenu.add(newItem);
   this.registerComponentEvent(newItem, eventName);
 }
Beispiel #10
0
  /**
   * createRadioButtonMenuItem
   *
   * @param ln the LineNumbersAction
   * @param title the label of the menuitem
   * @param state the state associated with the menuitem
   * @return JRadioButtonMenuItem
   */
  private static JRadioButtonMenuItem createRadioButtonMenuItem(final int state) {
    JRadioButtonMenuItem radio = new JRadioButtonMenuItem();
    radio.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent arg0) {
            LineNumbersAction.setState(state);
          }
        });

    return radio;
  }
Beispiel #11
0
 private ButtonGroup createButtonGroup() {
   ButtonGroup g1 = new ButtonGroup();
   for (int j = 0; j < 4; j++)
     for (int i = 0; i < 16; i++) {
       JRadioButtonMenuItem b = new JRadioButtonMenuItem(new PopupIcon(i + 16 * j));
       b.setSelectedIcon(null);
       b.addActionListener(this::doSelect);
       this.add(b);
       g1.add(b);
     }
   return g1;
 }
Beispiel #12
0
  /** Initialize and update the items. */
  @Override
  public void initItems() {
    if (!initialized) {
      return;
    }

    removeAll();
    JMenuItem mit = add(newWindowAction);
    setMenuShortCutAccelerator(mit, 'N');

    ArrayList<GeoGebraFrame> ggbInstances = GeoGebraFrame.getInstances();
    int size = ggbInstances.size();
    if (size == 1) return;

    addSeparator();
    StringBuilder sb = new StringBuilder();
    ButtonGroup bg = new ButtonGroup();
    JRadioButtonMenuItem mi;

    int current = -1;

    for (int i = 0; i < size; i++) {
      GeoGebraFrame ggb = ggbInstances.get(i);
      AppD application = ggb.getApplication();
      if (app == application) current = i;
    }

    for (int i = 0; i < size; i++) {
      GeoGebraFrame ggb = ggbInstances.get(i);
      AppD application = ggb.getApplication();

      sb.setLength(0);
      sb.append(i + 1);
      if (application != null) // Michael Borcherds 2008-03-03 bugfix
      if (application.getCurrentFile() != null) {
          sb.append(" ");
          sb.append(application.getCurrentFile().getName());
        }

      mi = new JRadioButtonMenuItem(sb.toString());
      if (application == this.app) mi.setSelected(true);
      ActionListener al = new RequestFocusListener(ggb);
      mi.addActionListener(al);
      if (i == ((current + 1) % size)) setMenuShortCutShiftAccelerator(mi, 'N');
      else if (i == ((current - 1 + size) % size)) setMenuShortCutShiftAltAccelerator(mi, 'N');
      bg.add(mi);
      add(mi);
    }

    // support for right-to-left languages
    app.setComponentOrientation(this);
  }
  /** Creates a JRadioButtonMenuItem for the Themes menu */
  private JMenuItem createThemesMenuItem(
      JMenu menu,
      String label,
      char mnemonic,
      String accessibleDescription,
      DefaultMetalTheme theme) {
    JRadioButtonMenuItem mi = (JRadioButtonMenuItem) menu.add(new JRadioButtonMenuItem(label));
    themesMenuGroup.add(mi);
    mi.setMnemonic(mnemonic);
    mi.getAccessibleContext().setAccessibleDescription(accessibleDescription);
    mi.addActionListener(new ChangeThemeAction(this, theme));

    return mi;
  }
Beispiel #14
0
  private JMenuBar createJMenu() {
    System.out.println("Creating the JMenu...");

    JMenu algMenu = new JMenu("Algorithms");
    ButtonGroup g = new ButtonGroup();
    ricartAgrawala = new JRadioButtonMenuItem("Ricart-Agrawala Algorithm");
    modRicartAgrawala = new JRadioButtonMenuItem("Modified Ricart-Agrawala Algorithm");
    ricartAgrawala.setSelected(true);
    g.add(ricartAgrawala);
    g.add(modRicartAgrawala);

    ricartAgrawala.addActionListener(this);
    modRicartAgrawala.addActionListener(this);

    algMenu.add(ricartAgrawala);
    algMenu.add(modRicartAgrawala);

    JMenu demosMenu = new JMenu("Demos");
    demosMenu.add(algMenu);

    authorMenuItem = new JMenuItem("Authors");
    problemMenuItem = new JMenuItem("Problem Description");

    authorMenuItem.addActionListener(this);
    problemMenuItem.addActionListener(this);

    JMenu aboutMenu = new JMenu("About");
    aboutMenu.add(authorMenuItem);
    aboutMenu.add(problemMenuItem);

    JMenuBar menuBar = new JMenuBar();
    menuBar.add(demosMenu);
    menuBar.add(aboutMenu);

    return menuBar;
  }
 JMenuBar createJMenuBar() {
   JMenuBar bar = new JMenuBar();
   JMenu file = new JMenu("File");
   bar.add(file);
   file.add(save);
   save.addActionListener(this);
   save.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_S, KeyEvent.CTRL_DOWN_MASK));
   file.add(savequit);
   savequit.addActionListener(this);
   savequit.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_W, KeyEvent.CTRL_DOWN_MASK));
   file.add(new JSeparator());
   file.add(sim);
   sim.addActionListener(this);
   real.addActionListener(this);
   file.add(real);
   file.add(new JSeparator());
   file.add(quit);
   quit.addActionListener(this);
   quit.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_Q, KeyEvent.CTRL_DOWN_MASK));
   JMenu skin = new JMenu("Skins");
   bar.add(skin);
   skin.add(crossSkin);
   crossSkin.addActionListener(this);
   crossSkin.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_1, KeyEvent.CTRL_DOWN_MASK));
   skin.add(systemSkin);
   systemSkin.addActionListener(this);
   systemSkin.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_2, KeyEvent.CTRL_DOWN_MASK));
   skin.add(napkinSkin);
   napkinSkin.addActionListener(this);
   napkinSkin.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_3, KeyEvent.CTRL_DOWN_MASK));
   ButtonGroup buttonGroup = new ButtonGroup();
   buttonGroup.add(crossSkin);
   buttonGroup.add(systemSkin);
   buttonGroup.add(napkinSkin);
   return bar;
 }
  /**
   * Create the Sleep for... Menu.
   *
   * @return the Sleep Menu
   */
  protected JMenu sleepMenu() {
    JMenu jms = new JMenu(KstatResources.getString("SLEEP.TEXT"));
    jms.setMnemonic(KeyEvent.VK_U);
    sleepItem1 = new JRadioButtonMenuItem(KstatResources.getString("SLEEP.1"));
    sleepItem1.addActionListener(this);
    sleepItem2 = new JRadioButtonMenuItem(KstatResources.getString("SLEEP.2"));
    sleepItem2.addActionListener(this);
    sleepItem5 = new JRadioButtonMenuItem(KstatResources.getString("SLEEP.5"), true);
    sleepItem5.addActionListener(this);
    sleepItem10 = new JRadioButtonMenuItem(KstatResources.getString("SLEEP.10"));
    sleepItem10.addActionListener(this);
    jms.add(sleepItem1);
    jms.add(sleepItem2);
    jms.add(sleepItem5);
    jms.add(sleepItem10);

    ButtonGroup sleepGroup = new ButtonGroup();
    sleepGroup.add(sleepItem1);
    sleepGroup.add(sleepItem2);
    sleepGroup.add(sleepItem5);
    sleepGroup.add(sleepItem10);

    return jms;
  }
Beispiel #17
0
 private static JMenu getMenu_ThemeOptions() {
   final JMenu menu = new JMenu("Theme");
   JRadioButtonMenuItem menuItem;
   final ButtonGroup group = new ButtonGroup();
   final String currentSkin = prefs.getPref(FPref.UI_SKIN);
   for (final String skin : FSkin.getAllSkins()) {
     menuItem = new JRadioButtonMenuItem(skin);
     group.add(menuItem);
     if (skin.equals(currentSkin)) {
       menuItem.setSelected(true);
     }
     menuItem.setActionCommand(skin);
     menuItem.addActionListener(changeSkin);
     menu.add(menuItem);
   }
   return menu;
 }
 /**
  * This method initializes jRadioButtonMenuItem1
  *
  * @return JRadioButtonMenuItem
  */
 private JRadioButtonMenuItem getJRadioButtonMenuItem1() {
   if (jRadioButtonMenuItem1 == null) {
     jRadioButtonMenuItem1 = new JRadioButtonMenuItem();
     jRadioButtonMenuItem1.setText("System");
     jRadioButtonMenuItem1.setMnemonic(java.awt.event.KeyEvent.VK_Y);
     jRadioButtonMenuItem1.setAccelerator(
         javax.swing.KeyStroke.getKeyStroke(
             java.awt.event.KeyEvent.VK_Y, java.awt.Event.ALT_MASK, false));
     jRadioButtonMenuItem1.addActionListener(
         new java.awt.event.ActionListener() {
           public void actionPerformed(java.awt.event.ActionEvent e) {
             changeLnF(UIManager.getSystemLookAndFeelClassName());
           }
         });
   }
   return jRadioButtonMenuItem1;
 }
Beispiel #19
0
  private JRadioButtonMenuItem getJRadioButtonMenuItemUpdateContact() {
    if (jRadioButtonMenuItemUpdateContact == null) {
      jRadioButtonMenuItemUpdateContact = new JRadioButtonMenuItem();
      jRadioButtonMenuItemUpdateContact.setText("Details");
      jRadioButtonMenuItemUpdateContact.addActionListener(
          new ActionListener() {
            public void actionPerformed(final ActionEvent e) {

              final String id = (String) jTableContactsModel.getValueAt(row, 0); // contact
              // number
              final Contact contact = ContactController.getContact(id);
              new JDialogContact(customer, contact, CRUDOperationEnum.UPDATE);
              refillContactsView();
            }
          });
    }
    return jRadioButtonMenuItemUpdateContact;
  }
Beispiel #20
0
  private JRadioButtonMenuItem getJRadioButtonMenuItemUpdateAddress() {
    if (jRadioButtonMenuItemUpdateAddress == null) {
      jRadioButtonMenuItemUpdateAddress = new JRadioButtonMenuItem();
      jRadioButtonMenuItemUpdateAddress.setText("Details");
      jRadioButtonMenuItemUpdateAddress.addActionListener(
          new ActionListener() {
            public void actionPerformed(final ActionEvent e) {

              final String id = (String) jTableAddressModel.getValueAt(row, 0); // product
              // number
              final Address address = AddressController.getAddress(id);
              new JDialogAddress(customer, address, CRUDOperationEnum.UPDATE);
              refillAddressView();
            }
          });
    }
    return jRadioButtonMenuItemUpdateAddress;
  }
 /**
  * This method initializes jRadioButtonMenuItem
  *
  * @return JRadioButtonMenuItem
  */
 private JRadioButtonMenuItem getJRadioButtonMenuItem() {
   if (jRadioButtonMenuItem == null) {
     jRadioButtonMenuItem = new JRadioButtonMenuItem();
     jRadioButtonMenuItem.setText("Default");
     jRadioButtonMenuItem.setSelected(true);
     jRadioButtonMenuItem.setAccelerator(
         javax.swing.KeyStroke.getKeyStroke(
             java.awt.event.KeyEvent.VK_D, java.awt.Event.ALT_MASK, false));
     jRadioButtonMenuItem.setMnemonic(java.awt.event.KeyEvent.VK_D);
     jRadioButtonMenuItem.addActionListener(
         new java.awt.event.ActionListener() {
           public void actionPerformed(java.awt.event.ActionEvent e) {
             changeLnF(UIManager.getCrossPlatformLookAndFeelClassName());
           }
         });
   }
   return jRadioButtonMenuItem;
 }
Beispiel #22
0
 private JRadioButtonMenuItem getJRadioButtonMenuItemDeleteContact() {
   if (jRadioButtonMenuItemDeleteContact == null) {
     jRadioButtonMenuItemDeleteContact = new JRadioButtonMenuItem();
     jRadioButtonMenuItemDeleteContact.setText("Verwijderen");
     jRadioButtonMenuItemDeleteContact.addActionListener(
         new ActionListener() {
           public void actionPerformed(final ActionEvent e) {
             final String id = (String) jTableContactsModel.getValueAt(row, 0); // contact
             final int response = JOptionPaneItemRemove.confirm(" contact " + id);
             if (response == JOptionPane.YES_OPTION) {
               ContactController.removeContact(id);
               refillContactsView();
             }
           }
         });
   }
   return jRadioButtonMenuItemDeleteContact;
 }
Beispiel #23
0
  public void chargerLaf() {
    MD_Laf.removeAll();
    // Groupe
    SC_RadioLaf = new ButtonGroup();

    // Look And Feel
    for (int i = 0; i < UIManager.getInstalledLookAndFeels().length; i++) {
      // Création d'un bouton radio
      JRadioButtonMenuItem OO_LookAndFeel =
          new JRadioButtonMenuItem(UIManager.getInstalledLookAndFeels()[i].getName());
      // Ajout au groupe
      SC_RadioLaf.add(OO_LookAndFeel);
      // Ajout du listener
      OO_LookAndFeel.addActionListener(actionLaf);
      // Si le look and feel courant correspond à l'élément
      if (OO_LookAndFeel.getText().equals(UIManager.getLookAndFeel().getName()))
        OO_LookAndFeel.setSelected(true);
      // Ajout au panel
      MD_Laf.add(OO_LookAndFeel);
    }
  }
Beispiel #24
0
 public void chargerLangue() {
   MD_Langue.removeAll();
   // Groupe
   SC_Radios = new ButtonGroup();
   // Radios langue
   for (int i = 0; i < Bundle.getLanguesDisponibles().size(); i++) {
     // Récupération de la première des langues disponibles
     String langue = Bundle.getLanguesDisponibles().elementAt(i).toString();
     // Récupération de la langue courante
     String langueCourante = Bundle.getLangueCourante();
     // Création d'un bouton radio
     JRadioButtonMenuItem OO_Langue = new JRadioButtonMenuItem(langue);
     // Ajout au groupe
     SC_Radios.add(OO_Langue);
     // Ajout du listener
     OO_Langue.addActionListener(actionLangue);
     // Si la langue courante correspond à l'élément
     if (langueCourante.equals(langue)) OO_Langue.setSelected(true);
     // Ajout au panel
     MD_Langue.add(OO_Langue);
   }
 }
Beispiel #25
0
  /**
   * Create a JFSstat demo.
   *
   * @param jkstat a JKstat object
   * @param standalone if false, indicates that this demo is being called from another application
   */
  public JFSstat(JKstat jkstat, boolean standalone) {
    super("jfsstat", standalone);

    mainPanel = new JFSstatPanel(jkstat, DEFAULT_INTERVAL);

    setContentPane(mainPanel);

    addInfoPanel(mainPanel, sversion);

    displayset = new HashSet<JRadioButtonMenuItem>();
    JMenu displayMenu = new JMenu(SolViewResources.getString("FSSTAT.DISPLAY.TEXT"));
    displayMenu.setMnemonic(KeyEvent.VK_D);
    String curtitle = mainPanel.currentTitle();
    ButtonGroup displayGroup = new ButtonGroup();
    for (String title : mainPanel.titles()) {
      JRadioButtonMenuItem jmis = new JRadioButtonMenuItem(title, title.equals(curtitle));
      displayMenu.add(jmis);
      displayGroup.add(jmis);
      displayset.add(jmis);
      jmis.addActionListener(this);
    }
    addMenu(displayMenu);

    JMenu showMenu = new JMenu(SolViewResources.getString("FSSTAT.SHOW.TEXT"));
    showMenu.setMnemonic(KeyEvent.VK_S);
    hiddenItem = new JCheckBoxMenuItem(SolViewResources.getString("FSSTAT.HIDDEN.TEXT"), false);
    hiddenItem.addActionListener(this);
    showMenu.add(hiddenItem);
    aggrItem = new JCheckBoxMenuItem(SolViewResources.getString("FSSTAT.FSTYPE.TEXT"), false);
    aggrItem.addActionListener(this);
    showMenu.add(aggrItem);
    addMenu(showMenu);

    setSize(620, 250);
    validate();
    setVisible(true);
  }
Beispiel #26
0
  JMenu buildThemeMenu() {

    Preferences pref = Preferences.userNodeForPackage(ThemeManager.class);
    String currentTheme = pref.get(THEME, DEFAULT_THEME);

    themesMenu = new JMenu();
    themesMenu.setText(rb.getString("Menu.Themes.Name"));
    themesMenu.setMnemonic(jgnash.ui.util.Resource.getMnemonic("Menu.Themes.Mnemonic"));

    ButtonGroup themeButtonGroup = new ButtonGroup();
    buildThemeList();

    JRadioButtonMenuItem button;

    for (Object aThemeList : themeList) {
      MetalTheme theme = (MetalTheme) aThemeList;
      button = new JRadioButtonMenuItem();
      button.setText(theme.getName());
      button.setActionCommand(theme.getClass().getName());
      button.addActionListener(
          e -> {
            Preferences pref1 = Preferences.userNodeForPackage(ThemeManager.class);
            pref1.put(THEME, e.getActionCommand());

            restartUI();
          });

      themeButtonGroup.add(button);
      themesMenu.add(button);
      if (aThemeList.getClass().getName().equals(currentTheme)) {
        button.setSelected(true);
      }
    }
    refreshThemesState();
    return themesMenu;
  }
Beispiel #27
0
  private JMenu buildSubstanceMenu() {
    LookAndFeel lf = UIManager.getLookAndFeel();

    JMenu substanceMenu = new JMenu(rb.getString("Menu.SubstanceThemes.Name"));

    for (SkinInfo info : SubstanceLookAndFeel.getAllSkins().values()) {
      JRadioButtonMenuItem button = new JRadioButtonMenuItem();
      button.setText(info.getDisplayName());
      button.setActionCommand(info.getClassName());

      // add the button to the global look and feel
      lfButtonGroup.add(button);

      button.addActionListener(
          e -> {
            Preferences pref = Preferences.userNodeForPackage(ThemeManager.class);
            pref.put(LF, e.getActionCommand());

            restartUI();
          });

      substanceMenu.add(button);

      // select the button as the active L&F if it is the current skin
      if (lf instanceof SubstanceLookAndFeel) {
        if (SubstanceLookAndFeel.getCurrentSkin()
            .getClass()
            .getName()
            .equals(info.getClassName())) {
          button.setSelected(true);
        }
      }
    }

    return substanceMenu;
  }
Beispiel #28
0
  public void buildMenuPanel() {
    // Menu
    menuBar = new JMenuBar();

    menuPanel = new JPanel();
    menuPanel.setLayout(new BorderLayout());
    menuPanel.add(menuBar, BorderLayout.NORTH);
    menuPanel.setVisible(true);
    menuPanel.setSize(400, 20);
    mainPanel.add(menuPanel);

    // File
    mFile = new JMenu("File");
    mFile.setMnemonic(KeyEvent.VK_F);
    menuBar.add(mFile);

    nextGame = new JMenuItem("New Game");
    nextGame.addActionListener(this);
    mFile.add(nextGame);

    reset = new JMenuItem("Reset Score");
    reset.addActionListener(this);
    mFile.add(reset);

    exit = new JMenuItem("Exit");
    exit.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            System.exit(0);
          }
        });
    mFile.add(exit);

    // Options
    mOptions = new JMenu("Game Options");
    mOptions.setMnemonic(KeyEvent.VK_O);
    menuBar.add(mOptions);

    // 1P 2P Selection RADIO--------------------
    pCount = new ButtonGroup();

    p1 = new JRadioButtonMenuItem("1 Player - Play against the computer");
    p1.addActionListener(this);
    p1.setSelected(true);
    pCount.add(p1);
    mOptions.add(p1);

    p2 = new JRadioButtonMenuItem("2 Player - Play with a friend");
    p2.addActionListener(this);
    pCount.add(p2);
    mOptions.add(p2);

    mOptions.addSeparator();
    // Player X O Selection RADIO--------------------
    xoSelect = new ButtonGroup();

    hx = new JRadioButtonMenuItem("Player 1 : X   - -   Player 2 : O");
    hx.addActionListener(this);
    hx.setSelected(true);
    xoSelect.add(hx);
    mOptions.add(hx);

    ho = new JRadioButtonMenuItem("Player 1 : O   - -   Player 2 : X");
    ho.addActionListener(this);

    xoSelect.add(ho);
    mOptions.add(ho);

    mOptions.addSeparator();

    // Player Skin Selection RADIO--------------------
    xoSkin = new ButtonGroup();

    plain = new JRadioButtonMenuItem("Traditional");
    plain.addActionListener(this);
    plain.setSelected(true);
    xoSkin.add(plain);
    mOptions.add(plain);

    fsu = new JRadioButtonMenuItem("FSU vs UF");
    fsu.addActionListener(this);
    xoSkin.add(fsu);
    mOptions.add(fsu);

    // Difficulty Selection
    mDiff = new JMenu("Difficulty");
    mDiff.setMnemonic(KeyEvent.VK_D);
    menuBar.add(mDiff);

    // Difficulty Selection Items
    diffSel = new ButtonGroup();

    easy = new JRadioButtonMenuItem("Easy");
    easy.setSelected(true);
    easy.addActionListener(this);
    diffSel.add(easy);
    mDiff.add(easy);

    hard = new JRadioButtonMenuItem("Hard");
    hard.addActionListener(this);
    diffSel.add(hard);
    mDiff.add(hard);

    impossible = new JRadioButtonMenuItem("Impossible");
    impossible.addActionListener(this);
    diffSel.add(impossible);
    mDiff.add(impossible);

    // About
    mAbout = new JMenu("About");
    mAbout.setMnemonic(KeyEvent.VK_A);
    menuBar.add(mAbout);

    info = new JMenuItem("About Me");
    info.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            printMessage("Tic Tac Toe\nCOP3252 Project 1\nJames Bach");
          }
        });
    mAbout.add(info);
  }
Beispiel #29
0
  private void jbInit() throws Exception {
    borderForProjectView = BorderFactory.createLineBorder(Color.black, 2);
    titleBoderForProjectView = new TitledBorder(borderForProjectView, "Project view");
    borderForEntitiesView = BorderFactory.createLineBorder(Color.black, 2);
    titledBorderForEntitiesView = new TitledBorder(borderForEntitiesView, "Entities view");
    titledBorderForMessagesPane =
        new TitledBorder(
            BorderFactory.createEtchedBorder(Color.white, new Color(148, 145, 140)), "Messages");
    this.getContentPane().setLayout(borderLayout2);
    file.setText("File");
    save.setEnabled(false);
    save.setText("Save");
    save.setName("Savefilemenu");
    save.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(ActionEvent e) {
            save_actionPerformed(e);
          }
        });
    load.setText("Load");
    load.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(ActionEvent e) {
            load_actionPerformed(e);
          }
        });
    this.setDefaultCloseOperation(DO_NOTHING_ON_CLOSE);
    this.setJMenuBar(mainMenuBar);
    this.setTitle("INGENIAS Development Kit");
    this.setSize(625, 470);
    this.addWindowListener(
        new java.awt.event.WindowAdapter() {
          public void windowClosed(WindowEvent e) {
            this_windowClosed(e);
          }

          public void windowClosing(WindowEvent e) {
            this_windowClosing(e);
          }
        });
    splitPaneSeparatingProjectsAndEntitiesView.setOrientation(JSplitPane.VERTICAL_SPLIT);
    splitPaneSeparatingProjectsAndEntitiesView.setBottomComponent(scrollPaneForEntitiesView);
    splitPaneSeparatingProjectsAndEntitiesView.setTopComponent(scrollPaneForProyectView);
    jPanel1.setLayout(gridLayout1);
    arbolObjetos.addMouseListener(
        new java.awt.event.MouseAdapter() {
          public void mouseClicked(MouseEvent e) {
            arbolObjetos_mouseClicked(e);
          }
        });
    scrollPaneForProyectView.setAutoscrolls(true);
    scrollPaneForProyectView.setBorder(titleBoderForProjectView);
    scrollPaneForEntitiesView.setBorder(titledBorderForEntitiesView);
    edit.setText("Edit");
    copyImage.setText("Copy diagram as a file");
    copyImage.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(ActionEvent e) {
            capture_actionPerformed(e);
          }
        });
    saveas.setText("Save as");
    saveas.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(ActionEvent e) {
            saveas_actionPerformed(e);
          }
        });
    help.setText("Help");
    manual.setText("Tool manual");
    manual.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(ActionEvent e) {
            manual_actionPerformed(e);
          }
        });
    about.setText("About");
    about.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(ActionEvent e) {
            about_actionPerformed(e);
          }
        });
    project.setText("Project");
    copy.setText("Copy");
    copy.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(ActionEvent e) {
            copy_actionPerformed(e);
          }
        });
    paste.setText("Paste");
    paste.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(ActionEvent e) {
            paste_actionPerformed(e);
          }
        });
    exit.setText("Exit");
    exit.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(ActionEvent e) {
            exit_actionPerformed(e);
          }
        });
    splitPanelDiagramMessagesPaneSeparator.setOrientation(JSplitPane.VERTICAL_SPLIT);
    splitPanelDiagramMessagesPaneSeparator.setLastDividerLocation(150);
    pprin.setLayout(new BorderLayout());
    pprin.setName("DiagramPane");
    pprin.setPreferredSize(new Dimension(400, 300));
    pprin.add(BorderLayout.SOUTH, pbar);
    pbar.setVisible(false);
    jSplitPane1.setOrientation(JSplitPane.HORIZONTAL_SPLIT);

    scrollLogs.setBorder(titledBorderForMessagesPane);
    scrollLogs.addKeyListener(
        new java.awt.event.KeyAdapter() {
          public void keyPressed(KeyEvent e) {
            jScrollPane3_keyPressed(e);
          }
        });
    this.clearMessages.setText("Clear");
    clearMessages.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(ActionEvent e) {
            clearMessages_actionPerformed(e, (JTextPane) messagesMenu.getInvoker());
          }
        });
    forcegc.setText("Force GC");
    forcegc.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(ActionEvent e) {
            forcegc_actionPerformed(e);
          }
        });

    menuTools.setText("Tools");
    menuCodeGenerator.setText("Code Generator");
    profiles.setText("Profiles");

    menuModules.setText("Modules");
    this.properties.setText("Properties");
    properties.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(ActionEvent e) {
            properties_actionPerformed(e);
          }
        });
    moutput.setEditable(false);
    moutput.setSelectionStart(0);
    moutput.setText("");
    moduleOutput.addMouseListener(
        new java.awt.event.MouseAdapter() {
          public void mouseClicked(MouseEvent e) {
            moduleOutput_mouseClicked(e);
          }
        });
    moduleOutput.setFont(new java.awt.Font("Monospaced", 0, 11));
    logs.setContentType("text/html");
    logs.setEditable(false);
    logs.setText("");
    logs.addMouseListener(
        new java.awt.event.MouseAdapter() {
          public void mouseClicked(MouseEvent e) {
            logs_mouseClicked(e);
          }
        });
    logs.addComponentListener(
        new java.awt.event.ComponentAdapter() {
          public void componentResized(ComponentEvent e) {
            logs_componentResized(e);
          }
        });
    newProject.setText("New");
    newProject.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(ActionEvent e) {
            newProject_actionPerformed(e);
          }
        });
    undo.setText("Undo");
    undo.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(ActionEvent e) {
            undo_actionPerformed(e);
          }
        });
    redo.setText("Redo");
    redo.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(ActionEvent e) {
            redo_actionPerformed(e);
          }
        });
    delete.setText("Delete");
    delete.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(ActionEvent e) {
            delete_actionPerformed(e);
          }
        });
    selectall.setText("Select all");
    selectall.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(ActionEvent e) {
            selectall_actionPerformed(e);
          }
        });
    cpClipboard.setText("Copy diagram to clipboard");
    cpClipboard.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(ActionEvent e) {
            cpClipboard_actionPerformed(e);
          }
        });
    preferences.setText("Preferences");

    enableUMLView.setToolTipText("UML view" + "instead of its type");
    enableUMLView.setText("Enable UML view from now on");
    enableUMLView.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(ActionEvent e) {
            enableUMLView_actionPerformed(e);
          }
        });
    enableINGENIASView.setToolTipText("INGENIAS view");
    enableINGENIASView.setText("Enable INGENIAS view from now on");
    enableINGENIASView.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(ActionEvent e) {
            enableINGENIASView_actionPerformed(e);
          }
        });

    switchINGENIASView.setToolTipText("Switch to INGENIAS view");
    switchINGENIASView.setText("Switch to INGENIAS view");
    switchINGENIASView.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(ActionEvent e) {
            switchINGENIASView_actionPerformed(e);
          }
        });

    switchUMLView.setToolTipText("Switch to UML view");
    switchUMLView.setText("Switch to UML view");
    switchUMLView.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(ActionEvent e) {
            switchUMLView_actionPerformed(e);
          }
        });

    resizeAll.setToolTipText("Resize all");
    resizeAll.setText("Resize all entities within current diagram");
    resizeAll.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(ActionEvent e) {
            resizeAll_actionPerformed(e);
          }
        });

    resizeAllDiagrams.setToolTipText("Resize all diagrams");
    resizeAllDiagrams.setText("Resize all entities within all defined diagram");
    resizeAllDiagrams.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(ActionEvent e) {
            resizeAllDiagrams_actionPerformed(e);
          }
        });

    JMenuItem workspaceEntry = new JMenuItem("Switch workspace");
    workspaceEntry.setToolTipText("Change current workspace");
    workspaceEntry.setText("Switch workspace");
    workspaceEntry.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(ActionEvent e) {
            changeWorkspace(e);
          }
        });
    preferences.add(workspaceEntry);
    preferences.add(resizeAll);
    preferences.add(resizeAllDiagrams);
    {
      elimOverlap = new JMenuItem();
      preferences.add(elimOverlap);
      elimOverlap.setText("Eliminate overlap");
      elimOverlap.setAccelerator(KeyStroke.getKeyStroke("F3"));
      elimOverlap.addMenuKeyListener(
          new MenuKeyListener() {
            public void menuKeyPressed(MenuKeyEvent evt) {
              System.out.println("elimOverlap.menuKeyPressed, event=" + evt);
              // TODO add your code for elimOverlap.menuKeyPressed
            }

            public void menuKeyReleased(MenuKeyEvent evt) {
              System.out.println("elimOverlap.menuKeyReleased, event=" + evt);
              // TODO add your code for elimOverlap.menuKeyReleased
            }

            public void menuKeyTyped(MenuKeyEvent evt) {
              elimOverlapMenuKeyTyped(evt);
            }
          });
      elimOverlap.addKeyListener(
          new KeyAdapter() {
            public void keyPressed(KeyEvent evt) {
              elimOverlapKeyPressed(evt);
            }
          });
      elimOverlap.addActionListener(
          new ActionListener() {
            public void actionPerformed(ActionEvent evt) {
              elimOverlapActionPerformed(evt);
            }
          });
    }
    {
      modelingLanguageNotationSwitchMenu = new JMenu();
      preferences.add(modelingLanguageNotationSwitchMenu);
      modelingLanguageNotationSwitchMenu.setText("Modelling language");
      modelingLanguageNotationSwitchMenu.add(enableINGENIASView);

      viewSelection.add(enableINGENIASView);
      modelingLanguageNotationSwitchMenu.add(enableUMLView);
      viewSelection.add(enableUMLView);

      enableINGENIASView.setSelected(true);
      modelingLanguageNotationSwitchMenu.add(switchUMLView);
      modelingLanguageNotationSwitchMenu.add(switchINGENIASView);
    }
    {
      propertiesModeMenu = new JMenu();
      preferences.add(propertiesModeMenu);
      propertiesModeMenu.setText("Edit Properties Mode");
      {
        editPopUpProperties = new JCheckBoxMenuItem();
        propertiesModeMenu.add(editPopUpProperties);
        editPopUpProperties.setText("Edit Properties in a PopUp Window");
        editPopUpProperties.setSelected(true);
        editPopUpProperties.addActionListener(
            new ActionListener() {
              public void actionPerformed(ActionEvent e) {
                editPopUpProperties_selected();
              }
            });
        propertiesEditModeSelection.add(editPopUpProperties);
      }
      {
        editOnMessages = new JCheckBoxMenuItem();
        propertiesModeMenu.add(editOnMessages);
        editOnMessages.setText("Edit Properties in Messages Panel");
        propertiesEditModeSelection.add(editOnMessages);
        editOnMessages.addActionListener(
            new ActionListener() {
              public void actionPerformed(ActionEvent e) {
                editOnMessages_selected();
              }
            });
      }
    }

    mainMenuBar.add(file);
    mainMenuBar.add(edit);
    mainMenuBar.add(project);
    mainMenuBar.add(menuModules);
    mainMenuBar.add(profiles);
    mainMenuBar.add(preferences);
    mainMenuBar.add(help);
    file.add(newProject);
    file.add(load);
    {
      importFile = new JMenuItem();
      file.add(importFile);
      importFile.setText("Import file");
      importFile.addActionListener(
          new ActionListener() {
            public void actionPerformed(ActionEvent evt) {
              importFileActionPerformed(evt);
            }
          });
    }
    file.add(save);
    file.add(saveas);
    file.addSeparator();
    file.add(exit);
    file.addSeparator();
    rightPanel.setLayout(new BorderLayout());
    rightPanel.add(buttonModelPanel, BorderLayout.WEST);
    this.getContentPane().add(jSplitPane1, BorderLayout.CENTER);
    rightPanel.add(splitPanelDiagramMessagesPaneSeparator, BorderLayout.CENTER);
    jSplitPane1.add(splitPaneSeparatingProjectsAndEntitiesView, JSplitPane.LEFT);
    splitPaneSeparatingProjectsAndEntitiesView.add(scrollPaneForProyectView, JSplitPane.TOP);
    {
      jPanel2 = new JPanel();
      BorderLayout jPanel2Layout = new BorderLayout();
      jPanel2.setLayout(jPanel2Layout);
      splitPaneSeparatingProjectsAndEntitiesView.add(jPanel2, JSplitPane.BOTTOM);
      jPanel2.add(jPanel1, BorderLayout.SOUTH);
      jPanel2.add(scrollPaneForEntitiesView, BorderLayout.CENTER);
    }
    jSplitPane1.add(rightPanel, JSplitPane.RIGHT);
    splitPanelDiagramMessagesPaneSeparator.add(pprin, JSplitPane.TOP);
    splitPanelDiagramMessagesPaneSeparator.add(messagespane, JSplitPane.BOTTOM);
    JScrollPane scrollSearchDiagram = new JScrollPane();
    scrollSearchDiagram.getViewport().add(searchDiagramPanel, null);
    searchDiagramPanel.setContentType("text/html");
    searchDiagramPanel.setEditable(false);

    messagespane.addConventionalTab(scrollLogs, "Logs");
    scrollLogs.getViewport().add(logs, null);
    scrolloutput.getViewport().add(this.moduleOutput, null);
    messagespane.addConventionalTab(scrolloutput, "Module Output");
    messagespane.addConventionalTab(scrollSearchDiagram, "Search");
    scrolloutput.getViewport().add(moduleOutput, null);
    {
      searchPanel = new JPanel();
      FlowLayout searchPanelLayout = new FlowLayout();
      searchPanelLayout.setVgap(1);
      searchPanel.setLayout(searchPanelLayout);
      jPanel1.add(searchPanel, BorderLayout.SOUTH);
      searchPanel.setBorder(BorderFactory.createBevelBorder(BevelBorder.LOWERED));
      {
        searchField = new JTextField();
        searchPanel.add(searchField);
        searchField.setColumns(15);

        searchField.addKeyListener(
            new KeyAdapter() {
              public void keyTyped(KeyEvent evt) {
                searchFieldKeyTyped(evt);
              }
            });
      }
      {
        Search = new JButton();
        scrollPaneForProyectView.setViewportView(arbolProyectos);
        scrollPaneForEntitiesView.setViewportView(arbolObjetos);
        searchPanel.add(Search);

        Search.setIcon(new ImageIcon(ImageLoader.getImage(("images/lense.png"))));
        //	Search.setPreferredSize(new java.awt.Dimension(20, 20));
        Search.setIconTextGap(0);
        Search.addActionListener(
            new ActionListener() {
              public void actionPerformed(ActionEvent evt) {
                SearchActionPerformed(evt);
              }
            });
      }
    }
    edit.add(undo);
    edit.add(redo);
    edit.addSeparator();
    edit.add(copy);
    edit.add(paste);
    edit.add(delete);
    edit.add(selectall);
    edit.addSeparator();
    edit.add(copyImage);
    edit.add(cpClipboard);
    help.add(manual);
    help.add(about);
    help.add(forcegc);

    menuModules.add(menuTools);
    menuModules.add(menuCodeGenerator);
    messagesMenu.add(this.clearMessages);
    project.add(this.properties);

    project.addSeparator();
    jSplitPane1.setDividerLocation(250);
    splitPaneSeparatingProjectsAndEntitiesView.setDividerLocation(250);
    arbolProyectos.addMouseListener(
        new java.awt.event.MouseAdapter() {
          public void mouseClicked(MouseEvent e) {
            arbolProyectos_mouseClicked(e);
          }
        });
    splitPanelDiagramMessagesPaneSeparator.setDividerLocation(400);
  }
  public void initUI() {
    // Search
    double[][] sizeSearch = new double[][] {{3, TableLayout.PREFERRED, 3, 100}, {25}};
    JPanel jpSearch = new JPanel(new TableLayout(sizeSearch));
    sbSearch = new SearchBox(CommandJPanel.this);
    JLabel jlSearch = new JLabel(IconLoader.ICON_SEARCH);
    jlSearch.setToolTipText(Messages.getString("CommandJPanel.23"));
    // Clear search text when clicking on the search icon
    jlSearch.addMouseListener(
        new MouseAdapter() {
          @Override
          public void mouseClicked(MouseEvent e) {
            sbSearch.setText("");
          }
        });
    jpSearch.add(jlSearch, "1,0");
    jpSearch.add(sbSearch, "3,0");

    // History
    JPanel jpHistory = new JPanel();
    jcbHistory = new SteppedComboBox();
    JLabel jlHistory = new JLabel(IconLoader.ICON_HISTORY);
    jlHistory.setToolTipText(Messages.getString("CommandJPanel.0"));
    // - Increase rating button
    ActionBase actionIncRate = ActionManager.getAction(JajukAction.INC_RATE);
    actionIncRate.setName(null);
    final JPopupMenu jpmIncRating = new JPopupMenu();
    for (int i = 1; i <= 10; i++) {
      final int j = i;
      JMenuItem jmi = new JMenuItem("+" + i);
      if (ConfigurationManager.getInt(CONF_INC_RATING) == i) {
        jmi.setFont(FontManager.getInstance().getFont(JajukFont.BOLD));
      }
      // Store selected value
      jmi.addActionListener(
          new ActionListener() {
            public void actionPerformed(ActionEvent e) {
              ConfigurationManager.setProperty(CONF_INC_RATING, "" + j);
            }
          });
      jpmIncRating.add(jmi);
    }
    jbIncRate =
        new DropDownButton(IconLoader.ICON_INC_RATING) {
          private static final long serialVersionUID = 1L;

          @Override
          protected JPopupMenu getPopupMenu() {
            return jpmIncRating;
          }
        };
    jbIncRate.setAction(actionIncRate);
    // we use a combo box model to make sure we get good performances after
    // rebuilding the entire model like after a refresh
    jcbHistory.setModel(new DefaultComboBoxModel(History.getInstance().getHistory()));
    // None selection because if we start in stop mode, a selection of the
    // first item will not launch the track because the selected item is
    // still the same and no action event is thrown (Java >= 1.6)
    jcbHistory.setSelectedItem(null);
    int iWidth = (int) (Toolkit.getDefaultToolkit().getScreenSize().getWidth() / 2);
    // size of popup
    jcbHistory.setPopupWidth(iWidth);
    // size of the combo itself, keep it! as text can be very long
    jcbHistory.setPreferredSize(new Dimension(250, 25));
    jcbHistory.setMinimumSize(new Dimension(0, 25));
    jcbHistory.setToolTipText(Messages.getString("CommandJPanel.0"));
    jcbHistory.addActionListener(CommandJPanel.this);
    JToolBar jtbIncRate = new JToolBar();
    jtbIncRate.setFloatable(false);
    jbIncRate.addToToolBar(jtbIncRate);
    double[][] sizeHistory =
        new double[][] {
          {3, TableLayout.PREFERRED, 3, TableLayout.FILL, 10, TableLayout.PREFERRED}, {25}
        };
    jpHistory.setLayout(new TableLayout(sizeHistory));
    jpHistory.add(jlHistory, "1,0");
    jpHistory.add(jcbHistory, "3,0");
    jpHistory.add(jtbIncRate, "5,0");

    // Mode toolbar
    // we need an inner toolbar to apply size properly
    JToolBar jtbModes = new JToolBar();
    jtbModes.setBorder(null);
    // make it not floatable as this behavior is managed by vldocking
    jtbModes.setFloatable(false);
    jtbModes.setRollover(true);
    jbRepeat =
        new JajukToggleButton(ActionManager.getAction(JajukAction.REPEAT_MODE_STATUS_CHANGE));
    jbRepeat.setSelected(ConfigurationManager.getBoolean(CONF_STATE_REPEAT));
    jbRandom =
        new JajukToggleButton(ActionManager.getAction(JajukAction.SHUFFLE_MODE_STATUS_CHANGED));
    jbRandom.setSelected(ConfigurationManager.getBoolean(CONF_STATE_SHUFFLE));
    jbContinue =
        new JajukToggleButton(ActionManager.getAction(JajukAction.CONTINUE_MODE_STATUS_CHANGED));
    jbContinue.setSelected(ConfigurationManager.getBoolean(CONF_STATE_CONTINUE));
    jbIntro = new JajukToggleButton(ActionManager.getAction(JajukAction.INTRO_MODE_STATUS_CHANGED));
    jbIntro.setSelected(ConfigurationManager.getBoolean(CONF_STATE_INTRO));
    jtbModes.add(jbRepeat);
    jtbModes.addSeparator();
    jtbModes.add(jbRandom);
    jtbModes.addSeparator();
    jtbModes.add(jbContinue);
    jtbModes.addSeparator();
    jtbModes.add(jbIntro);

    // Volume
    jpVolume = new JPanel();
    ActionUtil.installKeystrokes(
        jpVolume,
        ActionManager.getAction(JajukAction.DECREASE_VOLUME),
        ActionManager.getAction(JajukAction.INCREASE_VOLUME));

    jpVolume.setLayout(new BoxLayout(jpVolume, BoxLayout.X_AXIS));
    int iVolume = (int) (100 * ConfigurationManager.getFloat(CONF_VOLUME));
    if (iVolume > 100) { // can occur in some undefined cases
      iVolume = 100;
    }
    jsVolume = new JSlider(0, 100, iVolume);
    jpVolume.add(jsVolume);
    jpVolume.add(Box.createHorizontalStrut(5));
    jpVolume.add(jbMute);
    jsVolume.setToolTipText(Messages.getString("CommandJPanel.14"));
    jsVolume.addChangeListener(CommandJPanel.this);
    jsVolume.addMouseWheelListener(CommandJPanel.this);

    // Special functions toolbar
    // Ambience combo
    ambiencesCombo = new SteppedComboBox();
    iWidth = (int) (Toolkit.getDefaultToolkit().getScreenSize().getWidth() / 4);
    ambiencesCombo.setPopupWidth(iWidth);
    ambiencesCombo.setFont(FontManager.getInstance().getFont(JajukFont.BOLD_L));
    // size of the combo itself
    ambiencesCombo.setRenderer(
        new BasicComboBoxRenderer() {
          private static final long serialVersionUID = -6943363556191659895L;

          public Component getListCellRendererComponent(
              JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
            super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
            JLabel jl = (JLabel) value;
            setIcon(jl.getIcon());
            setText(jl.getText());
            return this;
          }
        });
    ambiencesCombo.setToolTipText(Messages.getString("DigitalDJWizard.66"));
    populateAmbiences();
    ambienceListener = new AmbienceListener();
    ambiencesCombo.addActionListener(ambienceListener);
    jtbSpecial = new JToolBar();
    jtbSpecial.setBorder(null);
    jtbSpecial.setRollover(true);
    jtbSpecial.setFloatable(false);
    ddbGlobalRandom =
        new DropDownButton(IconLoader.ICON_SHUFFLE_GLOBAL) {
          private static final long serialVersionUID = 1L;

          @Override
          protected JPopupMenu getPopupMenu() {
            return popupGlobalRandom;
          }
        };
    ddbGlobalRandom.setAction(ActionManager.getAction(JajukAction.SHUFFLE_GLOBAL));
    popupGlobalRandom = new JPopupMenu();
    // Global shuffle
    jmiShuffleModeSong = new JRadioButtonMenuItem(Messages.getString("CommandJPanel.20"));
    jmiShuffleModeSong.addActionListener(this);
    // album / album
    jmiShuffleModeAlbum = new JRadioButtonMenuItem(Messages.getString("CommandJPanel.21"));
    jmiShuffleModeAlbum.addActionListener(this);
    // Shuffle album / album
    jmiShuffleModeAlbum2 = new JRadioButtonMenuItem(Messages.getString("CommandJPanel.22"));
    jmiShuffleModeAlbum2.addActionListener(this);
    if (ConfigurationManager.getProperty(CONF_GLOBAL_RANDOM_MODE).equals(MODE_TRACK)) {
      jmiShuffleModeSong.setSelected(true);
    } else if (ConfigurationManager.getProperty(CONF_GLOBAL_RANDOM_MODE).equals(MODE_ALBUM2)) {
      jmiShuffleModeAlbum2.setSelected(true);
    } else {
      jmiShuffleModeAlbum.setSelected(true);
    }
    ButtonGroup bgGlobalRandom = new ButtonGroup();
    bgGlobalRandom.add(jmiShuffleModeSong);
    bgGlobalRandom.add(jmiShuffleModeAlbum);
    bgGlobalRandom.add(jmiShuffleModeAlbum2);
    popupGlobalRandom.add(jmiShuffleModeSong);
    popupGlobalRandom.add(jmiShuffleModeAlbum);
    popupGlobalRandom.add(jmiShuffleModeAlbum2);
    ddbGlobalRandom.setText(""); // no text visible

    jbBestof = new JajukButton(ActionManager.getAction(JajukAction.BEST_OF));

    ddbNovelties =
        new DropDownButton(IconLoader.ICON_NOVELTIES) {
          private static final long serialVersionUID = 1L;

          @Override
          protected JPopupMenu getPopupMenu() {
            return popupNovelties;
          }
        };
    ddbNovelties.setAction(ActionManager.getAction(JajukAction.NOVELTIES));
    popupNovelties = new JPopupMenu();
    jmiNoveltiesModeSong = new JRadioButtonMenuItem(Messages.getString("CommandJPanel.20"));
    jmiNoveltiesModeSong.addActionListener(this);
    jmiNoveltiesModeAlbum = new JRadioButtonMenuItem(Messages.getString("CommandJPanel.22"));
    jmiNoveltiesModeAlbum.addActionListener(this);
    if (ConfigurationManager.getProperty(CONF_NOVELTIES_MODE).equals(MODE_TRACK)) {
      jmiNoveltiesModeSong.setSelected(true);
    } else {
      jmiNoveltiesModeAlbum.setSelected(true);
    }
    ButtonGroup bgNovelties = new ButtonGroup();
    bgNovelties.add(jmiNoveltiesModeSong);
    bgNovelties.add(jmiNoveltiesModeAlbum);
    popupNovelties.add(jmiNoveltiesModeSong);
    popupNovelties.add(jmiNoveltiesModeAlbum);
    ddbNovelties.setText(""); // no text visible

    jbNorm = new JajukButton(ActionManager.getAction(FINISH_ALBUM));
    popupDDJ = new JPopupMenu();
    ddbDDJ =
        new DropDownButton(IconLoader.ICON_DIGITAL_DJ) {
          private static final long serialVersionUID = 1L;

          @Override
          protected JPopupMenu getPopupMenu() {
            return popupDDJ;
          }
        };
    ddbDDJ.setAction(ActionManager.getAction(JajukAction.DJ));
    populateDJs();
    // no text visible
    ddbDDJ.setText("");

    popupWebRadio = new XJPopupMenu(Main.getWindow());
    ddbWebRadio =
        new DropDownButton(IconLoader.ICON_WEBRADIO) {
          private static final long serialVersionUID = 1L;

          @Override
          protected JPopupMenu getPopupMenu() {
            return popupWebRadio;
          }
        };
    ddbWebRadio.setAction(ActionManager.getAction(JajukAction.WEB_RADIO));
    populateWebRadios();
    // no text
    ddbWebRadio.setText("");

    ddbDDJ.addToToolBar(jtbSpecial);
    ddbNovelties.addToToolBar(jtbSpecial);
    ddbGlobalRandom.addToToolBar(jtbSpecial);
    jtbSpecial.add(jbBestof);
    jtbSpecial.add(jbNorm);

    // Radio tool bar
    JToolBar jtbWebRadio = new JToolBar();
    jtbWebRadio.setBorder(null);
    jtbWebRadio.setRollover(true);
    jtbWebRadio.setFloatable(false);
    ddbWebRadio.addToToolBar(jtbWebRadio);

    // Play toolbar
    JToolBar jtbPlay = new JToolBar();
    jtbPlay.setBorder(null);
    jtbPlay.setFloatable(false);
    // add some space to get generic size
    jtbPlay.setRollover(true);
    ActionUtil.installKeystrokes(
        jtbPlay, ActionManager.getAction(NEXT_ALBUM), ActionManager.getAction(PREVIOUS_ALBUM));
    jbPrevious = new JajukButton(ActionManager.getAction(PREVIOUS_TRACK));
    jbNext = new JajukButton(ActionManager.getAction(NEXT_TRACK));
    jbRew = new JPressButton(ActionManager.getAction(REWIND_TRACK));
    jbPlayPause = new JajukButton(ActionManager.getAction(PLAY_PAUSE_TRACK));
    jbStop = new JajukButton(ActionManager.getAction(STOP_TRACK));
    jbFwd = new JPressButton(ActionManager.getAction(FAST_FORWARD_TRACK));

    jtbPlay.add(jbPrevious);
    jtbPlay.add(jbRew);
    jtbPlay.add(jbPlayPause);
    jtbPlay.add(jbStop);
    jtbPlay.add(jbFwd);
    jtbPlay.add(jbNext);

    // Add items
    FormLayout layout =
        new FormLayout(
            // --columns
            "3dlu,fill:min(10dlu;p):grow(0.5), 3dlu, "
                + // ambience
                "left:p, 2dlu"
                + // smart toolbar
                ", min(0dlu;p):grow(0.04), 3dlu,"
                + // glue
                " right:p, 10dlu, "
                + // search /modes
                "fill:p, 5dlu, "
                + // history/player
                "fill:min(60dlu;p):grow(0.2),3dlu", // volume/part of
            // history
            // --rows
            "2dlu, p, 2dlu, p, 2dlu"); // rows
    PanelBuilder builder = new PanelBuilder(layout); // , new
    // FormDebugPanel() );
    CellConstraints cc = new CellConstraints();
    // Add items
    builder.add(jtbWebRadio, cc.xyw(2, 2, 3)); // grid width = 3
    builder.add(ambiencesCombo, cc.xy(2, 4));
    builder.add(jtbSpecial, cc.xy(4, 4));
    builder.add(jpSearch, cc.xyw(6, 2, 4));
    builder.add(jpHistory, cc.xyw(10, 2, 4));
    builder.add(jtbModes, cc.xy(8, 4));
    builder.add(jtbPlay, cc.xy(10, 4));
    builder.add(jpVolume, cc.xy(12, 4));
    JPanel p = builder.getPanel();
    setLayout(new BoxLayout(this, BoxLayout.X_AXIS));
    add(p);
    // register to player events
    ObservationManager.register(CommandJPanel.this);

    // if a track is playing, display right state
    if (FIFO.getInstance().getCurrentFile() != null) {
      // update initial state
      update(
          new Event(
              EventSubject.EVENT_PLAYER_PLAY,
              ObservationManager.getDetailsLastOccurence(EventSubject.EVENT_PLAYER_PLAY)));
      // update the history bar
      update(new Event(EventSubject.EVENT_FILE_LAUNCHED));
      // check if some track has been launched before the view has been
      // displayed
      update(new Event(EventSubject.EVENT_HEART_BEAT));
    }
    // start timer
    timer.start();
  }