本文整理汇总了Java中javax.swing.JPopupMenu.addSeparator方法的典型用法代码示例。如果您正苦于以下问题:Java JPopupMenu.addSeparator方法的具体用法?Java JPopupMenu.addSeparator怎么用?Java JPopupMenu.addSeparator使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.swing.JPopupMenu
的用法示例。
在下文中一共展示了JPopupMenu.addSeparator方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: maybeShowPopup
import javax.swing.JPopupMenu; //导入方法依赖的package包/类
private void maybeShowPopup(MouseEvent e) {
if (e.isPopupTrigger()) {
JPopupMenu popupMenu = new JPopupMenu();
popupMenu.setFocusable(false);
popupMenu.add(jMenuItemUndo);
popupMenu.add(jMenuItemRedo);
popupMenu.addSeparator();
popupMenu.add(jMenuItemCut);
popupMenu.add(jMenuItemCopy);
popupMenu.add(jMenuItemPaste);
popupMenu.addSeparator();
if (jMenuItemInsCell.getAction().isEnabled()) {
popupMenu.add(jMenuItemInsCell);
jMenuItemInsCell.setEnabled(true);
popupMenu.add(jMenuItemInsRow);
jMenuItemInsRow.setEnabled(true);
popupMenu.addSeparator();
}
popupMenu.add(jMenuItemProp);
popupMenu.show(e.getComponent(), e.getX(), e.getY());
}
}
示例2: buildPopup
import javax.swing.JPopupMenu; //导入方法依赖的package包/类
@Override
public JPopupMenu buildPopup(int row) {
final JPopupMenu m = new JPopupMenu();
final Action playAction = new Player.LaunchAction(ModuleManagerWindow.this, file);
playAction.setEnabled(!Info.isModuleTooNew(metadata.getVassalVersion()));
m.add(playAction);
final Action editAction = new Editor.ListLaunchAction(ModuleManagerWindow.this, file);
editAction.setEnabled(!Info.isModuleTooNew(metadata.getVassalVersion()));
m.add(editAction);
m.add(new AbstractAction(Resources.getString("General.remove")) {
private static final long serialVersionUID = 1L;
public void actionPerformed(ActionEvent e) {
removeModule(file);
cleanupTileCache();
}
});
m.addSeparator();
m.add(addFolderAction);
m.addSeparator();
m.add(newExtensionAction);
m.add(addExtensionAction);
return m;
}
示例3: createPopupMenu
import javax.swing.JPopupMenu; //导入方法依赖的package包/类
/**
* Creates a popup menu for the resource tree.
* @param node tree node that the mouse is over
*/
JPopupMenu createPopupMenu(TreeNode node) {
JPopupMenu res = new JPopupMenu();
res.setFocusable(false);
res.add(getActions().getNewAction(getResourceKind()));
if (node instanceof ResourceTreeNode) {
res.add(getActions().getEditAction(getResourceKind()));
res.addSeparator();
res.add(getActions().getCopyAction(getResourceKind()));
res.add(getActions().getDeleteAction(getResourceKind()));
res.add(getActions().getRenameAction(getResourceKind()));
if (getResourceKind().isEnableable()) {
res.addSeparator();
res.add(getActions().getEnableAction(getResourceKind()));
}
}
return res;
}
示例4: build
import javax.swing.JPopupMenu; //导入方法依赖的package包/类
/**
* This method builds the popup menu.
*/
private void build(ActionMap actionMap) {
popupPresenter = new JPopupMenu();
cutAction = actionMap.get(DefaultEditorKit.cutAction);
copyAction = actionMap.get(DefaultEditorKit.copyAction);
pasteAction = actionMap.get(DefaultEditorKit.pasteAction);
selectAllAction = actionMap.get(DefaultEditorKit.selectAllAction);
popupPresenter.add(createMenuItem("CTL_MenuItem_Cut", KeyEvent.VK_X, cutAction));
popupPresenter.add(createMenuItem("CTL_MenuItem_Copy", KeyEvent.VK_C, copyAction));
popupPresenter.add(createMenuItem("CTL_MenuItem_Paste", KeyEvent.VK_V, pasteAction));
popupPresenter.addSeparator();
popupPresenter.add(createMenuItem("CTL_MenuItem_SelectAll", KeyEvent.VK_A, selectAllAction));
}
示例5: maybeShowPopup
import javax.swing.JPopupMenu; //导入方法依赖的package包/类
private void maybeShowPopup(MouseEvent e) {
if (e.isPopupTrigger()) {
JPopupMenu popupMenu = new JPopupMenu();
popupMenu.setFocusable(false);
popupMenu.add(jMenuItemUndo);
popupMenu.add(jMenuItemRedo);
popupMenu.addSeparator();
popupMenu.add(jMenuItemCut);
popupMenu.add(jMenuItemCopy);
popupMenu.add(jMenuItemPaste);
popupMenu.addSeparator();
if (jMenuItemInsCell.getAction().isEnabled()) {
popupMenu.add(jMenuItemInsCell);
jMenuItemInsCell.setEnabled(true);
popupMenu.add(jMenuItemInsRow);
jMenuItemInsRow.setEnabled(true);
popupMenu.addSeparator();
}
popupMenu.add(jMenuItemProp);
popupMenu.show(e.getComponent(), e.getX(), e.getY());
}
}
示例6: populatePopupMenu
import javax.swing.JPopupMenu; //导入方法依赖的package包/类
public void populatePopupMenu(final JPopupMenu menu) {
menu.add(ROW_ACTION);
menu.add(COLUMN_ACTION);
if (getTableHeader() != null) {
menu.addSeparator();
menu.add(FIT_COLUMN_ACTION);
menu.add(FIT_ALL_COLUMNS_ACTION);
menu.add(EQUAL_WIDTHS_ACTION);
}
if (isSortable()) {
menu.addSeparator();
menu.add(SORTING_ASCENDING_ACTION);
menu.add(SORTING_DESCENDING_ACTION);
}
if (getTableHeader() != null) {
if (getTableHeader().getReorderingAllowed()) {
menu.addSeparator();
menu.add(SORT_COLUMNS_BY_NAME_ACTION);
menu.add(RESTORE_COLUMN_ORDER_ACTION);
}
}
}
示例7: XMLTreeListener
import javax.swing.JPopupMenu; //导入方法依赖的package包/类
public XMLTreeListener(TreeViewPanel panel)
{
super(panel);
popupMenu = new JPopupMenu();
JMenuItem expandAllAttributesMenuItem = new JMenuItem("Expand all attributes");
expandAllAttributesMenuItem.addActionListener(this);
JMenuItem collapseAllAttributesMenuItem = new JMenuItem("Collapse all attributes");
collapseAllAttributesMenuItem.addActionListener(this);
JMenuItem expandAllNodesMenuItem = new JMenuItem("Expand all nodes");
expandAllNodesMenuItem.addActionListener(this);
JMenuItem collapseAllNodesMenuItem = new JMenuItem("Collapse all nodes");
collapseAllNodesMenuItem.addActionListener(this);
JMenuItem increaseVerticalNodeDistanceMenuItem = new JMenuItem("Increase vertical node distance");
increaseVerticalNodeDistanceMenuItem.addActionListener(this);
JMenuItem decreaseVerticalNodeDistanceMenuItem = new JMenuItem("Decrease vertical node distance");
decreaseVerticalNodeDistanceMenuItem.addActionListener(this);
JMenuItem increaseHorizontalNodeDistanceMenuItem = new JMenuItem("Increase horizontal node distance");
increaseHorizontalNodeDistanceMenuItem.addActionListener(this);
JMenuItem decreaseHorizontalNodeDistanceMenuItem = new JMenuItem("Decrease horizontal node distance");
decreaseHorizontalNodeDistanceMenuItem.addActionListener(this);
JMenuItem toggleEdgyLinesMenuItem = new JMenuItem("Toggle edgy lines");
toggleEdgyLinesMenuItem.addActionListener(this);
JMenuItem savePaneToFileMenuItem = new JMenuItem("Save tree display ...");
savePaneToFileMenuItem.addActionListener(this);
popupMenu.add(expandAllAttributesMenuItem);
popupMenu.add(collapseAllAttributesMenuItem);
popupMenu.addSeparator();
popupMenu.add(expandAllNodesMenuItem);
popupMenu.add(collapseAllNodesMenuItem);
popupMenu.addSeparator();
popupMenu.add(increaseVerticalNodeDistanceMenuItem);
popupMenu.add(decreaseVerticalNodeDistanceMenuItem);
popupMenu.addSeparator();
popupMenu.add(increaseHorizontalNodeDistanceMenuItem);
popupMenu.add(decreaseHorizontalNodeDistanceMenuItem);
popupMenu.addSeparator();
popupMenu.add(toggleEdgyLinesMenuItem);
popupMenu.addSeparator();
popupMenu.add(savePaneToFileMenuItem);
}
示例8: addFilterItems
import javax.swing.JPopupMenu; //导入方法依赖的package包/类
/** Adds menu items to start or stop filtering the selected paths. */
void addFilterItems(JPopupMenu menu) {
TreePath[] selectedValues = getSelectionPaths();
if (isFiltering() && selectedValues != null) {
menu.add(new FilterAction(selectedValues, true));
menu.add(new FilterAction(selectedValues, false));
menu.addSeparator();
}
}
示例9: addAction
import javax.swing.JPopupMenu; //导入方法依赖的package包/类
private void addAction(JPopupMenu popup, Action action) {
if (action == null) {
popup.addSeparator();
} else {
Class cls = (Class)action.getValue(KEY_CLASS);
if (Boolean.class.equals(cls)) {
Boolean boolvalue = (Boolean)action.getValue(KEY_BOOLVALUE);
JCheckBoxMenuItem item = new JCheckBoxMenuItem(action);
item.setSelected(boolvalue);
popup.add(item);
} else {
popup.add(action);
}
}
}
示例10: init
import javax.swing.JPopupMenu; //导入方法依赖的package包/类
void init(String layersXMLName) throws IOException {
Vector layers = ParseLink.parse(URLFactory.url(haxby.map.MapApp.TEMP_BASE_URL + "GMA/Layers/" + layersXMLName));
// ParseLink.printProperties( layers, 0);
rootEntry = new LayerEntry(null, new Vector(), "layers", "", null);
layers = ParseLink.getProperties( layers, "layer");
for( int i=0 ; i<layers.size() ; i++) {
addLayers( (Vector)layers.get(i), rootEntry);
}
layerTree = new JTree(rootEntry);
layerTree.setRootVisible(false);
layerTree.setShowsRootHandles(true);
/*
layerTree.addMouseListener( new MouseAdapter() {
public void mouseReleased(MouseEvent e) {
if(e.isPopupTrigger()) {
popup(e);
}
}
public void mousePressed(MouseEvent e) {
if(e.isPopupTrigger()) {
popup(e);
}
}
});
*/
renderer = new JLabel("");
renderer.setOpaque(true);
// layerTree.setCellRenderer(this);
// layerTree.setBackground( new Color(215,215,215) );
renderer.setBackground( new Color(225,225,255) );
pop = new JPopupMenu();
popLabel = new JLabel("");
popLabel.setHorizontalAlignment( JLabel.CENTER );
on = new JCheckBoxMenuItem( "display");
pop.add( popLabel );
pop.addSeparator();
pop.add( on );
pop.add( "edit properties");
}
示例11: createOperatorPopupMenu
import javax.swing.JPopupMenu; //导入方法依赖的package包/类
/** Creates a new popup menu for the selected operator. */
private JPopupMenu createOperatorPopupMenu() {
JPopupMenu menu = new JPopupMenu();
menu.add(this.INFO_OPERATOR_ACTION);
menu.addSeparator();
menu.add(new ResourceAction(true, "add_operator_now") {
private static final long serialVersionUID = 4363124048356045034L;
@Override
public void actionPerformed(final ActionEvent e) {
insertSelected();
}
});
menu.add(new DeleteUserDefinedAction() {
@Override
protected OperatorDescription getOperatorDescription() {
Object selectedOperator = operatorGroupTree.getSelectionPath().getLastPathComponent();
if (selectedOperator != null && selectedOperator instanceof OperatorDescription) {
return (OperatorDescription)selectedOperator;
} else {
return null;
}
}
private static final long serialVersionUID = 2563324048356045034L;
});
return menu;
}
示例12: createPopupMenu
import javax.swing.JPopupMenu; //导入方法依赖的package包/类
private JPopupMenu createPopupMenu() {
JPopupMenu menu = new JPopupMenu();
for (Action action : getActions()) {
if (action == null)
menu.addSeparator();
else {
action.putValue(Action.NAME, GlobalResourcesManager
.getString((String) action
.getValue(Action.ACTION_COMMAND_KEY)));
menu.add(action);
}
}
return menu;
}
示例13: configureMenu
import javax.swing.JPopupMenu; //导入方法依赖的package包/类
@Override
public void configureMenu(JPopupMenu menu, Project proj) {
this.circState = proj.getCircuitState();
boolean enabled = circState != null;
this.edit = createItem(enabled, Strings.get("ramEditMenuItem"));
this.reset = createItem(enabled, Strings.get("ramClearMenuItem"));
menu.addSeparator();
menu.add(this.edit);
menu.add(this.reset);
}
示例14: createTextPopupMenu
import javax.swing.JPopupMenu; //导入方法依赖的package包/类
private JPopupMenu createTextPopupMenu() {
JPopupMenu menu = new JPopupMenu();
menu.add(CUT_ACTION);
menu.add(COPY_ACTION);
menu.add(PASTE_ACTION);
menu.add(DELETE_ACTION);
// menu.addSeparator();
// menu.add(CLEAR_ALL_ACTION);
// menu.add(SELECT_ALL_ACTION);
menu.addSeparator();
menu.add(SEARCH_AND_REPLACE_ACTION);
return menu;
}
示例15: getPopupMenu
import javax.swing.JPopupMenu; //导入方法依赖的package包/类
@Override
public JPopupMenu getPopupMenu(Widget widget, Point point) {
JPopupMenu menu = diagramScene.createPopupMenu();
menu.addSeparator();
JMenu predecessors = new JMenu("Nodes Above");
predecessors.addMenuListener(new NeighborMenuListener(predecessors, getFigure(), false));
menu.add(predecessors);
JMenu successors = new JMenu("Nodes Below");
successors.addMenuListener(new NeighborMenuListener(successors, getFigure(), true));
menu.add(successors);
return menu;
}