本文整理汇总了Java中javax.swing.JMenu.remove方法的典型用法代码示例。如果您正苦于以下问题:Java JMenu.remove方法的具体用法?Java JMenu.remove怎么用?Java JMenu.remove使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.swing.JMenu
的用法示例。
在下文中一共展示了JMenu.remove方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: addMenuItems
import javax.swing.JMenu; //导入方法依赖的package包/类
/**
* Adds to a given menu all the items of another menu.
* The submenu may be {@code null}, in which case nothing is added
* @param submenu the menu to be added to the popup menu;
* will be destroyed as a consequence of this method call
*/
final public void addMenuItems(JMenu submenu) {
if (submenu != null && submenu.getItemCount() > 0) {
// as we move items from the submenu to the main menu
// the submenu gets modified
while (submenu.getItemCount() > 0) {
JMenuItem item = submenu.getItem(0);
if (item == null) {
submenu.remove(0);
addSeparator();
} else {
add(item);
}
}
}
}
示例2: detachWorkspace
import javax.swing.JMenu; //导入方法依赖的package包/类
/** Frees all listeners etc from given workspace. */
void detachWorkspace(
Workspace workspace, Hashtable workspace2Menu, Hashtable menu2Workspace, Hashtable workspace2Listener,
JMenu menu
) {
JRadioButtonMenuItem menuItem = (JRadioButtonMenuItem) workspace2Menu.get(workspace);
workspace2Menu.remove(workspace);
menu2Workspace.remove(workspace2Listener.get(workspace));
workspace2Listener.remove(workspace);
menu.remove(menuItem);
}
示例3: addExternalAction
import javax.swing.JMenu; //导入方法依赖的package包/类
/**
* Adds an action to the external actions menu of the simulator. This
* provides a primitive plugin mechanism.
*/
public void addExternalAction(Action action) {
JMenu externalMenu = getExternalActionsMenu();
// remove the dummy action if it is still there
if (externalMenu.getItem(0)
.getAction() == this.dummyExternalAction) {
externalMenu.remove(0);
}
getExternalActionsMenu().add(action);
}
示例4: fixMenu
import javax.swing.JMenu; //导入方法依赖的package包/类
private static void fixMenu(JMenu menu) {
for (int i = menu.getItemCount(); i > 3; i--) {
menu.remove(i - 1);
}
for (MysterFrame frame : windows) {
new MysterMenuItemFactory(frame.getTitle(), new OtherWindowHandler(frame))
.makeMenuItem(frame, menu);
}
}