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

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

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

JMenuBar.remove介绍

暂无

代码示例

代码示例来源:origin: org.activecomponents.jadex/jadex-kernel-extension-envsupport

/**
 * Removes a menu
 * 
 * @param menu the menu
 */
public void removeMenu(JMenu menu)
{
  menubar.remove(menu);
}

代码示例来源:origin: orbisgis/orbisgis

public void unsetDockingManager(DockingManager dockingManager) {
  menuBar.remove(panelList);
  this.dockingManager = null;
}

代码示例来源:origin: org.zaproxy/zap

private void removeMenuHelper(JMenuBar menuBar, List<JMenuItem> items) {
  for (JMenuItem item : items) {
    if (item != null) {
      menuBar.remove(item);
    }
  }
  menuBar.revalidate();
}

代码示例来源:origin: net.java.dev.laf-widget/laf-widget

@Override
public void uninstallUI() {
  this.jcomp.remove(this.searchPanel);
  super.uninstallUI();
}

代码示例来源:origin: PortSwigger/replicator

@Override
  public void run()
  {
    burpMenuBar.remove(replicatorMenu);
    burpMenuBar.repaint();
  }
});

代码示例来源:origin: net.java.openjdk.cacio/cacio-shared

public void delMenu(int index) {
  getSwingMenu().remove(index);
}

代码示例来源:origin: PortSwigger/distribute-damage

public void extensionUnloaded() {
    Utilities.getBurpFrame().getJMenuBar().remove(menuButton);
  }
}

代码示例来源:origin: PortSwigger/backslash-powered-scanner

public void extensionUnloaded() {
    JMenuBar burpMenuBar = getBurpFrame().getJMenuBar();
    burpMenuBar.remove(menuButton);
    burpMenuBar.repaint();
  }
}

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

@ScriptFunction(jsDoc = REMOVE_JSDOC, params = {"component"})
@Override
public void remove(JComponent aComp) {
  super.remove(aComp);
  super.revalidate();
  super.repaint();
}

代码示例来源:origin: PortSwigger/param-miner

public void extensionUnloaded() {
    JMenuBar jMenuBar = Utilities.getBurpFrame().getJMenuBar();
    jMenuBar.remove(menuButton);
    jMenuBar.repaint();
  }
}

代码示例来源:origin: stackoverflow.com

final JMenuBar menubar = new JMenuBar();
 SwingUtilities.invokeAndWait(new Runnable()
 {
   public void run()
   {
     JFrame f = new JFrame();
     f.setSize(300, 300);
     f.setJMenuBar(menubar);
     menubar.add(new JMenu("Magic"));
     menubar.add(new JMenu("Stain"));
     f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
     f.setVisible(true);
   }
 });
 SwingUtilities.invokeAndWait(new Runnable()
 {
   public void run()
   {
     for(int i = 0; i < menubar.getMenuCount(); i++)
     {
       JMenu item = menubar.getMenu(i);
       if(item != null && "Magic".equals(item.getText()))
       {
         menubar.remove(i);
         i--;
         menubar.doLayout();
       }
     }
   }
 });

代码示例来源:origin: net.java.openjdk.cacio/cacio-shared

public void addHelpMenu(Menu m) {
  // Remove old help menu, if there is one.
  JMenuBar jmb = getSwingMenu();
  if (helpMenu != null) {
    jmb.remove(getSwingMenu(helpMenu));
  }
  // Add new help menu.
  helpMenu = m;
  jmb.add(getSwingMenu(m));
  // Force re-layout.
  jmb.revalidate();
}

代码示例来源:origin: girtel/Net2Plan

/**
 * Refresh main menu with currently loaded GUI plugins.
 *
 * @since 0.3.1
 */
public static void refreshMenu() {
  instance.usedKeyStrokes.clear();
  while (instance.menu.getComponentCount() > 2) instance.menu.remove(1);
  for (Class<? extends Plugin> plugin : PluginSystem.getPlugins(IGUIModule.class)) {
    try {
      IGUIModule pluginInstance = ((Class<? extends IGUIModule>) plugin).newInstance();
      String menuName = pluginInstance.getMenu();
      JMenuItem item = getCurrentMenu(instance.menu, null, menuName);
      item.addActionListener(instance);
      KeyStroke keystroke = pluginInstance.getKeyStroke();
      if (keystroke != null && !instance.usedKeyStrokes.contains(keystroke)) {
        item.setAccelerator(keystroke);
        instance.usedKeyStrokes.add(keystroke);
      }
      instance.itemObject.put(item, plugin);
    } catch (NoClassDefFoundError e) {
      throw new Net2PlanException("Class " + e.getMessage() + " cannot be found. A dependence for " + plugin.getSimpleName() + " is missing?");
    } catch (Throwable e) {
      throw new RuntimeException(e);
    }
  }
  instance.menu.revalidate();
}

代码示例来源:origin: nccgroup/AutoRepeater

@Override
public void extensionUnloaded() {
 // unregister menu
 JMenuBar burpMenuBar = rootPane.getJMenuBar();
 BurpExtender.getCallbacks().printOutput("Unregistering menu");
 burpMenuBar.remove(autoRepeaterJMenu);
 burpMenuBar.repaint();
}

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

public void updateSelectedMenu() {
  JMenuBar menuBar = Utility.appMenuBar0;
  if (menuBar != null && selectedMenu != null) {
    menuBar.remove(selectedMenu);
    selectedMenu = null;
  }
  Object selected = nameItemChooserPanel.getSelectedObject();
  if (selected == collection) {
    selected = null;
  }
  if (selected != null) {
    selectedMenu = new TriggerMenu("With Selected", null, null, collection, selected);
    menuBar.add(selectedMenu);
  }
  nameItemChooserPanel.invalidate();
  nameItemChooserPanel.validate();
  nameItemChooserPanel.repaint();
}

代码示例来源:origin: net.java.dev.laf-widget/laf-widget

MenuSearchWidget.this.jcomp.remove(removed);
MenuSearchWidget.this.jcomp
    .add(removed, MenuSearchWidget.this.jcomp

代码示例来源:origin: jawi/ols

@Override
 public void run()
 {
  final JMenuBar menuBar = getMainMenuBar();
  if ( menuBar != null )
  {
   aProvider.removedFromContainer();
   menuBar.remove( aProvider.getComponent() );
   menuBar.revalidate();
   menuBar.repaint();
  }
 }
} );

代码示例来源:origin: net.sf.cuf/cuf-swing

mMenuBar.remove(menuItem);

代码示例来源:origin: org.biojava.thirdparty/forester

private void doUpdateProcessMenu() {
  if ( _process_pool.size() > 0 ) {
    if ( _process_menu == null ) {
      _process_menu = createMenu( "", getConfiguration() );
      _process_menu.setForeground( Color.RED );
    }
    _process_menu.removeAll();
    final String text = "processes running: " + _process_pool.size();
    _process_menu.setText( text );
    _jmenubar.add( _process_menu );
    for( int i = 0; i < _process_pool.size(); ++i ) {
      final ProcessRunning p = _process_pool.getProcessByIndex( i );
      _process_menu.add( customizeJMenuItem( new JMenuItem( p.getName() + " [" + p.getStart() + "]" ) ) );
    }
  }
  else {
    if ( _process_menu != null ) {
      _process_menu.removeAll();
      _jmenubar.remove( _process_menu );
    }
  }
  _jmenubar.validate();
  _jmenubar.repaint();
  repaint();
}

代码示例来源:origin: igniterealtime/Spark

/**
 * Rescaning our bookmarks and remaking menu items
 *
 * @param bookmarkMenu menu Jmenu
 */
public void rescan(JMenu bookmarkMenu) {
  bookmarkMenu.removeAll(); // removing old menus
  try {
    setBookmarks(bookmarkMenu); // making new 
    int onPanel = SparkManager.getMainWindow().getMenu().getComponentIndex(bookmarkMenu);
    if (onPanel < 0) {
      if (bookmarkMenu.getMenuComponentCount() > 0) {
        int menuCount = SparkManager.getMainWindow().getMenu().getMenuCount();
        SparkManager.getMainWindow().getMenu().add(bookmarkMenu, menuCount - 2);
      }
    }
    if (onPanel >= 0) {
      if (bookmarkMenu.getMenuComponentCount() <= 0) {
        SparkManager.getMainWindow().getMenu().remove(bookmarkMenu);
      }
    }
    SparkManager.getMainWindow().getMenu().invalidate();
    SparkManager.getMainWindow().getMenu().validate();
    SparkManager.getMainWindow().getMenu().repaint();
  } catch (XMPPException | SmackException | InterruptedException ex) {
    Log.error(ex);
  }
}

相关文章