javax.swing.JMenuItem.setVisible()方法的使用及代码示例

x33g5p2x  于2022-01-21 转载在 其他  
字(8.0k)|赞(0)|评价(0)|浏览(188)

本文整理了Java中javax.swing.JMenuItem.setVisible()方法的一些代码示例,展示了JMenuItem.setVisible()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JMenuItem.setVisible()方法的具体详情如下:
包路径:javax.swing.JMenuItem
类名称:JMenuItem
方法名:setVisible

JMenuItem.setVisible介绍

暂无

代码示例

代码示例来源:origin: pentaho/mondrian

lastUsed1MenuItem.setVisible(true);
} else {
  lastUsed1MenuItem.setVisible(false);
  lastUsed2MenuItem.setVisible(true);
} else {
  lastUsed2MenuItem.setVisible(false);
  lastUsed3MenuItem.setVisible(true);
} else {
  lastUsed3MenuItem.setVisible(false);
  lastUsed4MenuItem.setVisible(true);
} else {
  lastUsed4MenuItem.setVisible(false);

代码示例来源:origin: i2p/i2p.i2p

_jstatusItem.setText(status);
if (_jbrowserItem != null)
  _jbrowserItem.setVisible(!imminent);
if (_jconfigItem != null)
  _jconfigItem.setVisible(!imminent);
if (_jrestartItem != null)
  _jrestartItem.setVisible(!x);
if (_jstopItem != null)
  _jstopItem.setVisible(!x);
if (_jrestartHardItem != null)
  _jrestartHardItem.setVisible(!imminent);
if (_jstopHardItem != null)
  _jstopHardItem.setVisible(!imminent);
if (_jcancelItem != null)
  _jcancelItem.setVisible(x && !imminent);

代码示例来源:origin: org.jspresso.framework/jspresso-swing-application

@Override
 public void propertyChange(PropertyChangeEvent evt) {
  actionItem.setVisible((Boolean) evt.getNewValue());
 }
});

代码示例来源:origin: SKCraft/Launcher

@Override
public void show(Component invoker, int x, int y) {
  JTextComponent textComponent = (JTextComponent) invoker;
  boolean editable = textComponent.isEditable() && textComponent.isEnabled();
  cutItem.setVisible(editable);
  pasteItem.setVisible(editable);
  deleteItem.setVisible(editable);
  super.show(invoker, x, y);
}

代码示例来源:origin: SKCraft/SKMCLauncher

@Override
public void show(Component invoker, int x, int y) {
  JTextComponent textComponent = (JTextComponent) invoker;
  boolean editable = textComponent.isEditable() && textComponent.isEnabled();
  cutItem.setVisible(editable);
  pasteItem.setVisible(editable);
  deleteItem.setVisible(editable);
  super.show(invoker, x, y);
}

代码示例来源:origin: net.sourceforge.jadex/jadex-tools-comanalyzer

public void actionPerformed(ActionEvent e)
  {
    JMenuItem item = (JMenuItem)e.getSource();
    item.setVisible(false);
    addParameterMenuItems(extended_parameters);
    // prevent popup from closing
    setVisible(true);
  }
});

代码示例来源:origin: com.eas.platypus/platypus-js-forms

@ScriptFunction
@Override
public void setVisible(boolean aValue) {
  super.setVisible(aValue);
}

代码示例来源:origin: org.netbeans.modules/org-netbeans-lib-profiler-ui

public CPUResultsPanel(CPUResUserActionsHandler actionsHandler, Boolean sampling) {
  this.actionsHandler = actionsHandler;
  this.sampling = sampling;
  callGraphPopupMenu = createPopupMenu();
  if (popupFind != null) {
    popupFind.setVisible(false);
  }
}

代码示例来源:origin: org.apache.airavata/airavata-xbaya-gui

private JMenuItem createResetMonitoring() {
  JMenuItem item = new JMenuItem("Reset monitoring");
  item.setMnemonic(KeyEvent.VK_R);
  item.addActionListener(new AbstractAction() {
    public void actionPerformed(ActionEvent event) {
      engine.getMonitor().resetEventData();
    }
  });
  item.setVisible(false);
  return item;
}

代码示例来源:origin: javax.help/javahelp

private void maybeShowPopup(MouseEvent e) {
    TreePath path = tree.getSelectionPath();
    TreePath clickPath = tree.getPathForLocation(e.getX(),e.getY());
    if (e.isPopupTrigger()) { 
  if (path != null && path.equals(clickPath)) {
    separatorMI.setVisible(true);
    cutMI.setVisible(true);
    copyMI.setVisible(true);
    pasteMI.setVisible(true);
    removeMI.setVisible(true);
  } else {
    separatorMI.setVisible(false);
    cutMI.setVisible(false);
    copyMI.setVisible(false);
    pasteMI.setVisible(false);
    removeMI.setVisible(false);
  }
      popup.show(e.getComponent(), e.getX(), e.getY());
  }
}
}

代码示例来源:origin: org.apache.airavata/airavata-xbaya-gui

public void setVisible(boolean visible) {
  getMenuItem().setVisible(visible);
}

代码示例来源:origin: robo-code/robocode

private JMenuItem getRobotEditorMenuItem() {
  if (robotEditorMenuItem == null) {
    robotEditorMenuItem = new JMenuItem();
    robotEditorMenuItem.setText("Source Editor");
    robotEditorMenuItem.setMnemonic('E');
    robotEditorMenuItem.setVisible(net.sf.robocode.core.Container.getComponent(IRobocodeEditor.class) != null);
    robotEditorMenuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_E, MENU_SHORTCUT_KEY_MASK, false));
    robotEditorMenuItem.addActionListener(eventHandler);
  }
  return robotEditorMenuItem;
}

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-dlight-visualizers

@Override
  public void mouseClicked(MouseEvent e) {
    int clickedLine = table.rowAtPoint(e.getPoint());
    if (clickedLine != -1) {
      if ((e.getModifiers() & InputEvent.BUTTON3_MASK) != 0) {
        showLegend.setVisible(!isShowLegend);
        hideLegend.setVisible(isShowLegend);
        popupMenu.show(e.getComponent(), e.getX(), e.getY());
      } else if ((e.getModifiers() == InputEvent.BUTTON1_MASK)){
        if (e.getClickCount() == 1){
          onClickAction(e);
        } else if (e.getClickCount() == 2) {
          performDefaultAction();
        }
      }
    }
  }
});

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-visualweb-project-jsf

public JMenuItem getPresenter() {
    JMenuItem mainItem = new JMenuItem();

    if (type == TYPE_JSP) {
      String name = NbBundle.getMessage(SetStartPageAction.class, "LBL_SetAsStartPage");
      mainItem.setEnabled(!(JsfProjectUtils.isStartPage(fo) || fo.getExt().equalsIgnoreCase("jspf")));
      Mnemonics.setLocalizedText(mainItem, name);
      mainItem.addActionListener(this);
    } else {
      mainItem.setVisible(false);
    }

    return mainItem;
  }
}

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-dlight-visualizers

@Override
  public void keyPressed(KeyEvent e) {
    if ((e.getKeyCode() == KeyEvent.VK_CONTEXT_MENU) || ((e.getKeyCode() == KeyEvent.VK_F10) && (e.getModifiers() == InputEvent.SHIFT_MASK))) {
      int selectedRow = table.getSelectedRow();
      if (selectedRow != -1) {
        Rectangle cellRect = table.getCellRect(selectedRow, 0, false);
        showLegend.setVisible(!isShowLegend);
        hideLegend.setVisible(isShowLegend);
        popupMenu.show(e.getComponent(), ((cellRect.x + table.getSize().width) > 50) ? 50 : 5, cellRect.y);
      }
    }
  }
});

代码示例来源:origin: org.netbeans.modules/org-netbeans-lib-profiler-ui

@Override
  public void keyPressed(KeyEvent e) {
    if ((e.getKeyCode() == KeyEvent.VK_CONTEXT_MENU)
        || ((e.getKeyCode() == KeyEvent.VK_F10) && (e.getModifiers() == InputEvent.SHIFT_MASK))) {
      int selectedRow = resTable.getSelectedRow();
      if (selectedRow != -1) {
        if (popupShowSource != null) popupShowSource.setVisible(true);
        if (popupShowReverse != null) popupShowReverse.setVisible(true);
        popupPath = null;
        methodId = flatProfileContainer.getMethodIdAtRow(selectedRow);
        popupAddToRoots.setVisible(true);
        Rectangle cellRect = resTable.getCellRect(selectedRow, 0, false);
        callGraphPopupMenu.show(e.getComponent(), ((cellRect.x + resTable.getSize().width) > 50) ? 50 : 5,
                    cellRect.y);
      }
    }
  }
});

代码示例来源:origin: igvteam/igv

@Override
  public void receiveEvent(final Object event) {

    if(event instanceof GenomeChangeEvent) {
      UIUtilities.invokeOnEventThread(() -> encodeMenuItem.setVisible (EncodeFileBrowser.genomeSupported(((GenomeChangeEvent) event).genome.getId())));
    }
  }
}

代码示例来源:origin: net.sourceforge.mydoggy/mydoggy-plaf

protected void enableMaximize() {
    maximize.setVisible(toolWindow.isVisible());
    maximize.setText(toolWindow.isMaximized() ?
             resourceManager.getString("@@tool.maximize.restore") :
             resourceManager.getString("@@tool.maximize"));
  }
}

代码示例来源:origin: org.apache.airavata/airavata-xbaya-gui

private JMenuItem createPauseMonitoring() {
  JMenuItem item = new JMenuItem("Pause monitoring", MenuIcons.MONITOR_PAUSE_ICON);
  item.setMnemonic(KeyEvent.VK_T);
  AbstractAction action = new AbstractAction() {
    public void actionPerformed(ActionEvent event) {
      try {
        engine.getMonitor().stopMonitoring();
      } catch (RuntimeException e) {
        engine.getGUI().getErrorWindow().error(ErrorMessages.MONITOR_ERROR, e);
      } catch (Error e) {
        engine.getGUI().getErrorWindow().error(ErrorMessages.UNEXPECTED_ERROR, e);
      }
    }
  };
  item.addActionListener(action);
  item.setVisible(false);
  toolbarButtonPauseMonitor = getToolBar().addToolbarButton(EXECUTE_MONITOR_ACTIONS,item.getText(), MenuIcons.MONITOR_PAUSE_ICON, "Pause monitoring", action,3);
  toolbarButtonPauseMonitor.setEnabled(false);
  return item;
}

代码示例来源:origin: org.apache.cayenne.modeler/cayenne-modeler

public void popupMenuFilter() {
  Action cutAction = mediator.getApplication().getActionManager().getAction(CutAction.class);
  for (MenuElement element : popup.getSubElements()) {
    JMenuItem item = (JMenuItem) element;
    if (!item.getAction().equals(cutAction)) {
      item.setVisible(item.isEnabled());
    } else {
      break;
    }
  }
}

相关文章

JMenuItem类方法