javax.swing.JMenuBar.removeAll()方法的使用及代码示例

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

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

JMenuBar.removeAll介绍

暂无

代码示例

代码示例来源:origin: net.sf.doolin/doolin-gui

@Override
public void clear() {
  this.menuBar.removeAll();
}

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

@ScriptFunction(jsDoc = CLEAR_JSDOC)
@Override
public void clear() {
  super.removeAll();
  super.revalidate();
  super.repaint();
}

代码示例来源:origin: org.appdapter/org.appdapter.lib.gui

private void resetMenu() {
  JMenuBar menuBar;
  JMenu menu, submenu;
  menuBar = myTopFrameMenu = Utility.getMenuBar();
  myTopFrameMenu.removeAll();
  menuBar.add(Utility.clipBoardUtil.getFileMenu());
  menu = Utility.toolsMenu = new SafeJMenu(false, "Tools", this);
  menu.setMnemonic(KeyEvent.VK_T);
  menu.getAccessibleContext().setAccessibleDescription("Tool menu items");
  menuBar.add(menu);
  menu = Utility.lastResultsMenu = new SafeJMenu(false, "Results", this);
  menu.setMnemonic(KeyEvent.VK_R);
  menu.getAccessibleContext().setAccessibleDescription("Last returns");
  menuBar.add(menu);
  if (Utility.isLAFSafe())
    createLookAndFeelMenu();
  if (oldJMenuBar != null && oldJMenuBar != menuBar)
    menuBar.add(oldJMenuBar);
}

代码示例来源:origin: net.sf.taverna.t2.workbench/menu-impl

/**
 * Fill the specified menu bar with the menu elements that have the given
 * URI as their parent.
 * <p>
 * Existing elements on the menu bar will be removed.
 * </p>
 * 
 * @param menuBar
 *            The {@link JMenuBar} to update
 * @param id
 *            The {@link URI} of the menu bar
 */
protected void populateMenuBar(JMenuBar menuBar, URI id) {
  menuBar.removeAll();
  MenuComponent menuDef = uriToMenuElement.get(id);
  if (menuDef == null) {
    throw new IllegalArgumentException("Unknown menuBar " + id);
  }
  if (!menuDef.getType().equals(MenuType.menu)) {
    throw new IllegalArgumentException("Element " + id
        + " is not a menu, but a " + menuDef.getType());
  }
  for (Component component : makeComponents(id, false, false)) {
    if (component == null) {
      logger.warn("Ignoring separator in menu bar " + id);
    } else {
      menuBar.add(component);
    }
  }
}

代码示例来源:origin: net.sf.taverna.t2.ui-impl/menu-impl

menuBar.removeAll();
MenuComponent menuDef = uriToMenuElement.get(id);
if (menuDef == null) {

代码示例来源:origin: nz.ac.waikato.cms.weka/weka-stable

@Override
 public void actionPerformed(ActionEvent e) {
  Component[] comps = getComponents();
  Perspective current = null;
  int pIndex = 0;
  for (int i = 0; i < comps.length; i++) {
   if (comps[i] instanceof Perspective) {
    pIndex = i;
    current = (Perspective) comps[i];
    break;
   }
  }
  if (current == m_mainPerspective) {
   return;
  }
  current.setActive(false);
  remove(pIndex);
  add((JComponent) m_mainPerspective, BorderLayout.CENTER);
  m_perspectives.get(0).setActive(true);
  m_appMenuBar.removeAll();
  m_appMenuBar.add(m_programMenu);
  List<JMenu> mainMenus = m_perspectives.get(0).getMenus();
  for (JMenu m : mainMenus) {
   m_appMenuBar.add(m);
  }
  m_mainApp.revalidate();
 }
});

代码示例来源:origin: org.jfree/com.springsource.org.jfree

/**
 * Updates the global menu bar.
 * @return the fully initialized menu bar.
 */
private JMenuBar updateGlobalMenubar () {
 JMenuBar menuBar = getJMenuBar();
 if (menuBar == null) {
   menuBar = new JMenuBar();
 }
 else {
   menuBar.removeAll();
 }
 addMenus(menuBar, getPrefixMenus());
 for (int i = 0; i < this.rootEditors.size(); i++)
 {
   final RootEditor editor = (RootEditor) this.rootEditors.get(i);
   addMenus(menuBar, editor.getMenus());
 }
 addMenus(menuBar, getPostfixMenus());
 return menuBar;
}

代码示例来源:origin: org.jfree/jcommon

/**
 * Updates the global menu bar.
 * @return the fully initialized menu bar.
 */
private JMenuBar updateGlobalMenubar () {
 JMenuBar menuBar = getJMenuBar();
 if (menuBar == null) {
   menuBar = new JMenuBar();
 }
 else {
   menuBar.removeAll();
 }
 addMenus(menuBar, getPrefixMenus());
 for (int i = 0; i < this.rootEditors.size(); i++)
 {
   final RootEditor editor = (RootEditor) this.rootEditors.get(i);
   addMenus(menuBar, editor.getMenus());
 }
 addMenus(menuBar, getPostfixMenus());
 return menuBar;
}

代码示例来源:origin: jfree/jcommon

/**
 * Updates the global menu bar.
 * @return the fully initialized menu bar.
 */
private JMenuBar updateGlobalMenubar () {
 JMenuBar menuBar = getJMenuBar();
 if (menuBar == null) {
   menuBar = new JMenuBar();
 }
 else {
   menuBar.removeAll();
 }
 addMenus(menuBar, getPrefixMenus());
 for (int i = 0; i < this.rootEditors.size(); i++)
 {
   final RootEditor editor = (RootEditor) this.rootEditors.get(i);
   addMenus(menuBar, editor.getMenus());
 }
 addMenus(menuBar, getPostfixMenus());
 return menuBar;
}

代码示例来源:origin: Waikato/weka-trunk

@Override
 public void actionPerformed(ActionEvent e) {
  Component[] comps = getComponents();
  Perspective current = null;
  int pIndex = 0;
  for (int i = 0; i < comps.length; i++) {
   if (comps[i] instanceof Perspective) {
    pIndex = i;
    current = (Perspective) comps[i];
    break;
   }
  }
  if (current == m_mainPerspective) {
   return;
  }
  current.setActive(false);
  remove(pIndex);
  add((JComponent) m_mainPerspective, BorderLayout.CENTER);
  m_perspectives.get(0).setActive(true);
  m_appMenuBar.removeAll();
  m_appMenuBar.add(m_programMenu);
  List<JMenu> mainMenus = m_perspectives.get(0).getMenus();
  for (JMenu m : mainMenus) {
   m_appMenuBar.add(m);
  }
  m_mainApp.revalidate();
 }
});

代码示例来源:origin: otros-systems/otroslogviewer

setJMenuBar(menuBar);
menuBar.removeAll();
JMenu fileMenu = new JMenu("File");
fileMenu.setMnemonic(KeyEvent.VK_F);

代码示例来源:origin: Waikato/weka-trunk

m_appMenuBar.removeAll();
m_appMenuBar.add(programMenu);
List<JMenu> mainMenus = m_perspectives.get(theIndex).getMenus();

代码示例来源:origin: nz.ac.waikato.cms.weka/weka-stable

m_appMenuBar.removeAll();
m_appMenuBar.add(programMenu);
List<JMenu> mainMenus = m_perspectives.get(theIndex).getMenus();

代码示例来源:origin: org.jfree/com.springsource.org.jfree

/**
 * Creates a menu bar.
 *
 * @param root
 * @return A menu bar.
 */
private JMenuBar createEditorMenubar(final RootEditor root) {
  JMenuBar menuBar = getJMenuBar();
  if (menuBar == null) {
    menuBar = new JMenuBar();
  }
  else {
    menuBar.removeAll();
  }
  addMenus(menuBar, getPrefixMenus());
  if (isGlobalMenu())
  {
    for (int i = 0; i < this.rootEditors.size(); i++)
    {
      final RootEditor editor = (RootEditor) this.rootEditors.get(i);
      addMenus(menuBar, editor.getMenus());
    }
  }
  else
  {
    addMenus(menuBar, root.getMenus());
  }
  addMenus(menuBar, getPostfixMenus());
  return menuBar;
}

代码示例来源:origin: jfree/jcommon

/**
 * Creates a menu bar.
 *
 * @param root
 * @return A menu bar.
 */
private JMenuBar createEditorMenubar(final RootEditor root) {
  JMenuBar menuBar = getJMenuBar();
  if (menuBar == null) {
    menuBar = new JMenuBar();
  }
  else {
    menuBar.removeAll();
  }
  addMenus(menuBar, getPrefixMenus());
  if (isGlobalMenu())
  {
    for (int i = 0; i < this.rootEditors.size(); i++)
    {
      final RootEditor editor = (RootEditor) this.rootEditors.get(i);
      addMenus(menuBar, editor.getMenus());
    }
  }
  else
  {
    addMenus(menuBar, root.getMenus());
  }
  addMenus(menuBar, getPostfixMenus());
  return menuBar;
}

代码示例来源:origin: org.jfree/jcommon

/**
 * Creates a menu bar.
 *
 * @param root
 * @return A menu bar.
 */
private JMenuBar createEditorMenubar(final RootEditor root) {
  JMenuBar menuBar = getJMenuBar();
  if (menuBar == null) {
    menuBar = new JMenuBar();
  }
  else {
    menuBar.removeAll();
  }
  addMenus(menuBar, getPrefixMenus());
  if (isGlobalMenu())
  {
    for (int i = 0; i < this.rootEditors.size(); i++)
    {
      final RootEditor editor = (RootEditor) this.rootEditors.get(i);
      addMenus(menuBar, editor.getMenus());
    }
  }
  else
  {
    addMenus(menuBar, root.getMenus());
  }
  addMenus(menuBar, getPostfixMenus());
  return menuBar;
}

代码示例来源:origin: elki-project/elki

proj = item.proj;
menubar.removeAll();
menubar.add(filemenu);
ResultHierarchy hier = context.getHierarchy();

代码示例来源:origin: de.lmu.ifi.dbs.elki/elki-batik-visualization

proj = item.proj;
menubar.removeAll();
menubar.add(filemenu);
ResultHierarchy hier = context.getHierarchy();

代码示例来源:origin: org.java.net.substance/substance

/**
 * Uninstalls the necessary state.
 */
public void uninstall() {
  this.uninstallListeners();
  this.window = null;
  HeapStatusThread.unregisterPanel(this.heapStatusPanel);
  // Swing bug (?) - the updateComponentTree never gets to the
  // system menu (and in our case we have radio menu items with
  // rollover listeners). Fix for defect 109 - memory leak on skin
  // switch
  if ((this.menuBar != null) && (this.menuBar.getMenuCount() > 0)) {
    this.menuBar.getUI().uninstallUI(this.menuBar);
    SubstanceCoreUtilities.uninstallMenu(this.menuBar.getMenu(0));
  }
  if (this.heapStatusPanel != null) {
    for (MouseListener listener : this.heapStatusPanel
        .getMouseListeners())
      this.heapStatusPanel.removeMouseListener(listener);
    HeapStatusThread.unregisterPanel(this.heapStatusPanel);
    this.remove(this.heapStatusPanel);
  }
  if (this.menuBar != null)
    this.menuBar.removeAll();
  this.removeAll();
}

代码示例来源:origin: com.github.insubstantial/substance

/**
 * Uninstalls the necessary state.
 */
public void uninstall() {
  this.uninstallListeners();
  this.window = null;
  HeapStatusThread.unregisterPanel(this.heapStatusPanel);
  // Swing bug (?) - the updateComponentTree never gets to the
  // system menu (and in our case we have radio menu items with
  // rollover listeners). Fix for defect 109 - memory leak on skin
  // switch
  if ((this.menuBar != null) && (this.menuBar.getMenuCount() > 0)) {
    this.menuBar.getUI().uninstallUI(this.menuBar);
    SubstanceCoreUtilities.uninstallMenu(this.menuBar.getMenu(0));
  }
  if (this.heapStatusPanel != null) {
    for (MouseListener listener : this.heapStatusPanel
        .getMouseListeners())
      this.heapStatusPanel.removeMouseListener(listener);
    HeapStatusThread.unregisterPanel(this.heapStatusPanel);
    this.remove(this.heapStatusPanel);
  }
  if (this.menuBar != null)
    this.menuBar.removeAll();
  this.removeAll();
}

相关文章