本文整理匯總了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);
}
}