Ejemplo n.º 1
0
  private void computeContents() {
    ButtonGroup bgroup = new ButtonGroup();
    bgroup.add(nullItem);

    removeAll();
    add(minimize);
    add(zoom);
    add(close);

    if (!persistentItems.isEmpty()) {
      addSeparator();
      for (JRadioButtonMenuItem item : persistentItems) {
        bgroup.add(item);
        add(item);
      }
    }

    if (!transientItems.isEmpty()) {
      addSeparator();
      for (JRadioButtonMenuItem item : transientItems) {
        bgroup.add(item);
        add(item);
      }
    }

    WindowMenuItemManager currentManager = WindowMenuManager.getCurrentManager();
    if (currentManager != null) {
      JRadioButtonMenuItem item = currentManager.getMenuItem(this);
      if (item != null) {
        item.setSelected(true);
      }
    }
  }
Ejemplo n.º 2
0
  public WindowMenu(JFrame owner) {
    this.owner = owner;
    WindowMenuManager.addMenu(this);

    int menuMask = getToolkit().getMenuShortcutKeyMask();
    minimize.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_M, menuMask));
    close.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_W, menuMask));

    if (owner == null) {
      minimize.setEnabled(false);
      zoom.setEnabled(false);
      close.setEnabled(false);
    } else {
      minimize.addActionListener(myListener);
      zoom.addActionListener(myListener);
      close.addActionListener(myListener);
    }

    computeEnabled();
    computeContents();

    LocaleManager.addLocaleListener(myListener);
    myListener.localeChanged();
  }
Ejemplo n.º 3
0
	public static void showPreferences() {
		JFrame frame = MENU_MANAGER.getJFrame(true);
		frame.setVisible(true);
	}
Ejemplo n.º 4
0
 void computeEnabled() {
   WindowMenuItemManager currentManager = WindowMenuManager.getCurrentManager();
   minimize.setEnabled(currentManager != null);
   zoom.setEnabled(currentManager != null);
   close.setEnabled(currentManager != null);
 }