Пример #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);
      }
    }
  }
Пример #2
0
 void computeEnabled() {
   WindowMenuItemManager currentManager = WindowMenuManager.getCurrentManager();
   minimize.setEnabled(currentManager != null);
   zoom.setEnabled(currentManager != null);
   close.setEnabled(currentManager != null);
 }