当前位置: 首页>>代码示例>>Java>>正文


Java JPopupMenu.add方法代码示例

本文整理汇总了Java中javax.swing.JPopupMenu.add方法的典型用法代码示例。如果您正苦于以下问题:Java JPopupMenu.add方法的具体用法?Java JPopupMenu.add怎么用?Java JPopupMenu.add使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在javax.swing.JPopupMenu的用法示例。


在下文中一共展示了JPopupMenu.add方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createContextMenu

import javax.swing.JPopupMenu; //导入方法依赖的package包/类
/**
 * @return {@link JPopupMenu} for manipulating an entry in the network
 *         table.
 */
private JPopupMenu createContextMenu() {
	JPopupMenu menu = new JPopupMenu();
	ActionListener listener = new ContextHandler(this);
	String[] menuItems = {
			CHANGE_GENERATOR_LBL,		CHANGE_GENERATOR_ACTN,
			CONFIGURE_GENERATOR_LBL,	CONFIGURE_GENERATOR_ACTN,
			COPY_CONFIGURATION_LBL,		COPY_CONFIGURATION_ACTN,
			PASTE_CONFIGURATION_LBL,	PASTE_CONFIGURATION_ACTN
	};

	for (int i = 0; i < menuItems.length / 2; i++) {
		JMenuItem item = new JMenuItem(menuItems[i*2]);
		item.setActionCommand(menuItems[i*2+1]);
		item.addActionListener(listener);
		menu.add(item);

		if (item.getText().equals(PASTE_CONFIGURATION_LBL)) {
			this.paste = item;
			item.setEnabled(false);
		}
	}

	return menu;
}
 
开发者ID:KeepTheBeats,项目名称:alevin-svn2,代码行数:29,代码来源:MultiAlgoScenarioWizard.java

示例2: ResultTab

import javax.swing.JPopupMenu; //导入方法依赖的package包/类
public ResultTab(String id) {
	setLayout(new BorderLayout());
	this.id = id;
	this.dockKey = new DockKey(id, "Result " + id);
	this.dockKey.setDockGroup(MainFrame.DOCK_GROUP_RESULTS);
	this.dockKey.setName(id);
	this.dockKey.setFloatEnabled(true);
	this.dockKey.setIconDisplayed(true);
	DockableActionCustomizer customizer = new DockableActionCustomizer() {

		@Override
		public void visitTabSelectorPopUp(JPopupMenu popUpMenu, Dockable dockable) {
			popUpMenu.add(new JMenuItem(new StoreInRepositoryAction(resultObject)));
			popUpMenu.add(new JMenuItem(new CloseAllResultsAction(RapidMinerGUI.getMainFrame())));
		}
	};
	customizer.setTabSelectorPopUpCustomizer(true); // enable tabbed dock custom popup menu
	// entries
	this.dockKey.setActionCustomizer(customizer);
	label = makeStandbyLabel();
	add(label, BorderLayout.CENTER);
}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:23,代码来源:ResultTab.java

示例3: addFoldingActionsToPopUpMenu

import javax.swing.JPopupMenu; //导入方法依赖的package包/类
private void addFoldingActionsToPopUpMenu(JPopupMenu menu,
        List<TabAction> activeActions) {
    JMenu submenu = new JMenu(NbBundle.getMessage(
            OutputTab.class, "LBL_OutputFolds"));                   //NOI18N
    for (ACTION a : popUpFoldItems) {
        if (a == null) {
            submenu.addSeparator();
        } else {
            TabAction ta = action(a);
            activeActions.add(ta);
            submenu.add(new JMenuItem(ta));
        }
    }
    menu.addSeparator();
    menu.add(submenu);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:17,代码来源:OutputTab.java

示例4: populateMenu

import javax.swing.JPopupMenu; //导入方法依赖的package包/类
protected void populateMenu (JPopupMenu menu, Map context) {
        ActionProvider provider = getEngine().getActionProvider();
        String[] names = provider.getActionNames(ContainerProvider.CONTEXTMENU_CONTEXT);
        for (int i=0; i < names.length; i++) {
            JMenuItem item = getOrCreateMenuItem(
                provider.getActionType(names[i], ContainerProvider.CONTEXTMENU_CONTEXT));
            configureMenuItem (item, ContainerProvider.CONTEXTMENU_CONTEXT, names[i], provider, context);
            menu.add(item);
        }
//        getEngine().notifyMenuShown(ContainerProvider.CONTEXTMENU_CONTEXT, menu); //XXX listener should do this
//        addMapping (ContainerProvider.CONTEXTMENU_CONTEXT, menu, ContainerProvider.TYPE_MENU); //XXX handle popup
    }
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:13,代码来源:AbstractContextMenuFactory.java

示例5: addJoinRoomAction

import javax.swing.JPopupMenu; //导入方法依赖的package包/类
protected void addJoinRoomAction(JPopupMenu popup, Room target) {
  joinAction = new JoinRoomAction(target, client);
  popup.add(joinAction);
  if (target instanceof LockableRoom) {
    LockableRoom nr = (LockableRoom) target;
    if (nr.isLocked()) {
      joinAction.setEnabled(false);
    }
  }
}
 
开发者ID:ajmath,项目名称:VASSAL-src,代码行数:11,代码来源:LockableRoomControls.java

示例6: addShowHideItems

import javax.swing.JPopupMenu; //导入方法依赖的package包/类
/** Adds menu items for graying out. */
private void addShowHideItems(JPopupMenu result) {
    // add the show/hide menu
    @SuppressWarnings({"unchecked", "rawtypes"})
    JPopupMenu restMenu = new ShowHideMenu(this.jGraph).getPopupMenu();
    while (restMenu.getComponentCount() > 0) {
        result.add(restMenu.getComponent(0));
    }
}
 
开发者ID:meteoorkip,项目名称:JavaGraph,代码行数:10,代码来源:LabelTree.java

示例7: 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");
	}
 
开发者ID:iedadata,项目名称:geomapapp,代码行数:40,代码来源:LayerModel.java

示例8: HQLEditorPopupMouseAdapter

import javax.swing.JPopupMenu; //导入方法依赖的package包/类
public HQLEditorPopupMouseAdapter() {
    super();
    popupMenu = new JPopupMenu();
    ActionListener actionListener = new PopupActionListener();
    runHQLMenuItem = popupMenu.add(RUN_HQL_COMMAND);
    runHQLMenuItem.setMnemonic('Q');
    runHQLMenuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_H, InputEvent.ALT_MASK | InputEvent.SHIFT_MASK, false));
    runHQLMenuItem.addActionListener(actionListener);

    popupMenu.addSeparator();

    cutMenuItem = popupMenu.add(CUT_COMMAND);
    cutMenuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_X, InputEvent.CTRL_MASK, true));
    cutMenuItem.setMnemonic('t');
    cutMenuItem.addActionListener(actionListener);

    copyMenuItem = popupMenu.add(COPY_COMMAND);
    copyMenuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_C, InputEvent.CTRL_MASK, true));
    copyMenuItem.setMnemonic('y');
    copyMenuItem.addActionListener(actionListener);

    pasteMenuItem = popupMenu.add(PASTE_COMMAND);
    pasteMenuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_V, InputEvent.CTRL_MASK, true));
    pasteMenuItem.setMnemonic('P');
    pasteMenuItem.addActionListener(actionListener);
    
    popupMenu.addSeparator();
    
    selectAllMenuItem = popupMenu.add(SELECT_ALL_COMMAND);
    selectAllMenuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_A, InputEvent.CTRL_MASK, true));
    selectAllMenuItem.setMnemonic('A');
    selectAllMenuItem.addActionListener(actionListener);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:34,代码来源:HQLEditorTopComponent.java

示例9: bug6495920

import javax.swing.JPopupMenu; //导入方法依赖的package包/类
public bug6495920(JFrame frame) {
    JPopupMenu menu = new JPopupMenu() {
        public void setVisible(boolean visible) {
            super.setVisible(visible);
            throw new AssertionError(visible ? "show popup" : "hide popup");
        }
    };
    for (int i = 0; i < 10; i++) {
        menu.add(new JMenuItem(String.valueOf(i)));
    }
    this.panel = new JPanel();
    this.panel.setComponentPopupMenu(menu);
    frame.add(this.panel);
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:15,代码来源:bug6495920.java

示例10: createPopupMenu

import javax.swing.JPopupMenu; //导入方法依赖的package包/类
@Override
protected JPopupMenu createPopupMenu() {
    FeatureDescriptor fd = getSelection();
    if (fd != null) {
        if (fd instanceof RuleEditorNode.DeclarationProperty) {
            //property
            //
            //actions:
            //remove
            //hide
            //????
            //custom popop for the whole panel
            JPopupMenu pm = new JPopupMenu();

            if(!addPropertyMode) {
                pm.add(new GoToSourceAction(RuleEditorPanel.this, (RuleEditorNode.DeclarationProperty) fd));
                pm.addSeparator();
                pm.add(new RemovePropertyAction(RuleEditorPanel.this, (RuleEditorNode.DeclarationProperty) fd));
            }

            return pm;

        } else if (fd instanceof RuleEditorNode.PropertyCategoryPropertySet) {
            //property category
            //TODO possibly add "add property" action which would
            //preselect the css category in the "add property dialog".
        }
    }

    //no context popup - create the generic popup
    return genericPopupMenu;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:33,代码来源:RuleEditorPanel.java

示例11: createTablePopupMenu

import javax.swing.JPopupMenu; //导入方法依赖的package包/类
private void createTablePopupMenu() {
	pm = new JPopupMenu();
	JMenuItem mi = new JMenuItem("Select Matching Cells");
	mi.setActionCommand("match");
	mi.addActionListener(this);
	pm.add(mi);
	pm.addSeparator();
	createSavePopupMenuItems();
}
 
开发者ID:iedadata,项目名称:geomapapp,代码行数:10,代码来源:CustomDB.java

示例12: LineSegmentsObject

import javax.swing.JPopupMenu; //导入方法依赖的package包/类
public LineSegmentsObject( XMap map, Digitizer dig ) {
	this.map = map;
	wrap = map.getWrap();
	this.dig = dig;
	points = new Vector();
	visible = true;
	currentSeg = null;
	name = null;
	selected = false;
	lineWidth = 1f;
	color = Color.black;
	when = 0L;
	currentPoint = -1;
	editShape = null;
	active = false;
	setColor( dig.options.color );
	setFill( dig.options.fill );
	setStroke( dig.options.stroke );
	lastColor = color;
	lastFill = Color.white;
	table = 0;
	
	rightClickMenu = new JPopupMenu("Popup");
	JMenuItem deleteItem = new JMenuItem("Delete Point");
	deleteItem.setToolTipText("Click to delete");
	deleteItem.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
          dig.deletePtsBtn.doClick();
        }
      });
	rightClickMenu.add(deleteItem);
}
 
开发者ID:iedadata,项目名称:geomapapp,代码行数:33,代码来源:LineSegmentsObject.java

示例13: actionPerformed

import javax.swing.JPopupMenu; //导入方法依赖的package包/类
@Override
public void actionPerformed(ActionEvent e)
{
	saveCurrent();

	final JPopupMenu menu = new JPopupMenu();
	final PopupPanel popupPanel = new PopupPanel(menu);
	menu.add(popupPanel);
	menu.show(I18nTextField.this, 5, 5);
}
 
开发者ID:equella,项目名称:Equella,代码行数:11,代码来源:I18nTextField.java

示例14: 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;
}
 
开发者ID:arodchen,项目名称:MaxSim,代码行数:16,代码来源:FigureWidget.java

示例15: makeMouseMenu

import javax.swing.JPopupMenu; //导入方法依赖的package包/类
@Override
protected JPopupMenu makeMouseMenu() {
	JPopupMenu menu = new JPopupMenu();
	menu.add(deleteStation);
	return menu;
}
 
开发者ID:HOMlab,项目名称:QN-ACTR-Release,代码行数:7,代码来源:StationsPanel.java


注:本文中的javax.swing.JPopupMenu.add方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。