Java Code Examples for javax.swing.JPopupMenu#add()

The following examples show how to use javax.swing.JPopupMenu#add() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: GuiMouseListener.java    From WorldGrower with GNU General Public License v3.0 6 votes vote down vote up
private void addRestActions(JPopupMenu menu, WorldObject worldObject) {
	if (Game.canActionExecute(playerCharacter, Actions.SLEEP_ACTION, Args.EMPTY, world, worldObject)) {
		JMenuItem restMultipleTurnsMenuItem = MenuFactory.createJMenuItem(new GuiRestMultipleTurnsAction(playerCharacter, imageInfoReader, soundIdReader, world, container, dungeonMaster, worldObject, parentFrame), soundIdReader);
		restMultipleTurnsMenuItem.setText("Sleep multiple turns...");
		setMenuIcon(restMultipleTurnsMenuItem, ImageIds.SLEEPING_INDICATOR);
		restMultipleTurnsMenuItem.setToolTipText(Actions.SLEEP_ACTION.getDescription());
		menu.add(restMultipleTurnsMenuItem);
		
		GuiRestUntilRestedAction guiRestUntilRestedAction = new GuiRestUntilRestedAction(playerCharacter, imageInfoReader, soundIdReader, world, container, dungeonMaster, worldObject, parentFrame);
		JMenuItem restUntilRestedMenuItem = MenuFactory.createJMenuItem(guiRestUntilRestedAction, soundIdReader);
		restUntilRestedMenuItem.setText("Sleep " +  guiRestUntilRestedAction.getTurns() + " turns until energy is recovered");
		setMenuIcon(restUntilRestedMenuItem, ImageIds.SLEEPING_INDICATOR);
		restUntilRestedMenuItem.setEnabled(guiRestUntilRestedAction.getTurns() > 0);
		restUntilRestedMenuItem.setToolTipText(Actions.SLEEP_ACTION.getDescription());
		menu.add(restUntilRestedMenuItem);
	}
}
 
Example 2
Source File: RefactoringPanelContainer.java    From netbeans with Apache License 2.0 6 votes vote down vote up
/** Creates new form RefactoringPanelContainer */
private RefactoringPanelContainer(String name, boolean isRefactoring) {
    setName(name);
    setToolTipText(name);
    setFocusable(true);
    setLayout(new java.awt.BorderLayout());
    setMinimumSize(new Dimension(1,1));
    getAccessibleContext().setAccessibleDescription(
        NbBundle.getMessage(RefactoringPanelContainer.class, "ACSD_usagesPanel")
    );
    pop = new JPopupMenu();
    pop.add(new Close());
    pop.add(new CloseAll());
    pop.add(new CloseAllButCurrent());
    listener = new PopupListener();
    closeL = new CloseListener();
    this.isRefactoring = isRefactoring;
    setFocusCycleRoot(true);
    JLabel label = new JLabel(NbBundle.getMessage(RefactoringPanelContainer.class, "LBL_NoUsages"));
    label.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
    label.setEnabled(false);
    this.add(label, BorderLayout.CENTER);
    initActions();
}
 
Example 3
Source File: DockableResultDisplay.java    From rapidminer-studio with GNU Affero General Public License v3.0 6 votes vote down vote up
public DockableResultDisplay() {
	this.dockKey.setDockGroup(MainFrame.DOCK_GROUP_RESULTS);
	DockableActionCustomizer customizer = new DockableActionCustomizer() {

		@Override
		public void visitTabSelectorPopUp(JPopupMenu popUpMenu, Dockable dockable) {
			popUpMenu.add(new JMenuItem(new CloseAllResultsAction(RapidMinerGUI.getMainFrame())));
		}
	};
	customizer.setTabSelectorPopUpCustomizer(true); // enable tabbed dock custom popup menu
													 // entries
	this.dockKey.setActionCustomizer(customizer);
	setLayout(new BorderLayout());
	ExtendedJScrollPane overviewScrollpane = new ExtendedJScrollPane(overview);
	overviewScrollpane.setBorder(null);
	overviewScrollpane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);
	overviewScrollpane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
	add(overviewScrollpane, BorderLayout.CENTER);
	tableUpdateQueue.start();
}
 
Example 4
Source File: EquipInfoTab.java    From pcgen with GNU Lesser General Public License v2.1 6 votes vote down vote up
@Override
public void showPopup(MouseEvent e)
{
	List<EquipNode> targets = getMenuTargets(equipmentSetTable, e);
	if (targets.isEmpty())
	{
		return;
	}

	JPopupMenu popupMenu = new JPopupMenu();
	popupMenu.add(new MoveEquipUpMenuItem(character, targets));
	popupMenu.add(new MoveEquipDownMenuItem(character, targets));
	popupMenu.addSeparator();
	popupMenu.add(new SortEquipMenuItem(character, targets));
	popupMenu.show(e.getComponent(), e.getX(), e.getY());
}
 
Example 5
Source File: GuiMouseListener.java    From WorldGrower with GNU General Public License v3.0 6 votes vote down vote up
private void addVoteActions(JPopupMenu menu, WorldObject worldObject) {
	if (canPlayerCharacterPerformAction(worldObject, Actions.VOTE_FOR_LEADER_ACTION)) {
		JMenuItem guiVoteMenuItem = MenuFactory.createJMenuItem(new GuiVoteAction(playerCharacter, imageInfoReader, soundIdReader, world, container, dungeonMaster, worldObject, parentFrame), soundIdReader);
		guiVoteMenuItem.setText("Vote...");
		setMenuIcon(guiVoteMenuItem, Actions.VOTE_FOR_LEADER_ACTION.getImageIds(playerCharacter));
		guiVoteMenuItem.setToolTipText(Actions.VOTE_FOR_LEADER_ACTION.getDescription());
		menu.add(guiVoteMenuItem);
	}
	if (VotingPropertyUtils.isVotingBox(worldObject)) {
		JMenuItem guiViewCandidatesMenuItem = MenuFactory.createJMenuItem(new GuiViewCandidatesAction(playerCharacter, imageInfoReader, soundIdReader, world, container, dungeonMaster, worldObject, parentFrame), soundIdReader);
		guiViewCandidatesMenuItem.setText("View Candidates...");
		setMenuIcon(guiViewCandidatesMenuItem, Actions.VOTE_FOR_LEADER_ACTION.getImageIds(playerCharacter));
		guiViewCandidatesMenuItem.setToolTipText("View list of candidates for the election");
		menu.add(guiViewCandidatesMenuItem);
	}
}
 
Example 6
Source File: MergeDialogComponent.java    From netbeans with Apache License 2.0 5 votes vote down vote up
private static JPopupMenu createPopupMenu(MergePanel panel) {
    JPopupMenu popup = new JPopupMenuPlus();
    SystemAction[] actions = panel.getSystemActions();
    for (int i = 0; i < actions.length; i++) {
        if (actions[i] == null) {
            popup.addSeparator();
        } else if (actions[i] instanceof CallableSystemAction) {
            popup.add(((CallableSystemAction)actions[i]).getPopupPresenter());
            //add FileSystemAction to pop-up menu
        } else if (actions[i] instanceof FileSystemAction) {
            popup.add(((FileSystemAction)actions[i]).getPopupPresenter());
        }
    }
    return popup;
}
 
Example 7
Source File: MainWindow.java    From wpcleaner with Apache License 2.0 5 votes vote down vote up
/**
 * Add an item to the generate lists menu.
 * 
 * @param menu Menu.
 * @param mode List to be generated.
 */
private void addItemInInternalLinks(JPopupMenu menu, PageListWorker.Mode mode) {
  JMenuItem item = Utilities.createJMenuItem(mode.getTitle(), true);
  item.setActionCommand(mode.name());
  item.addActionListener(EventHandler.create(
      ActionListener.class, this, "actionInternalLinks", "actionCommand"));
  menu.add(item);
}
 
Example 8
Source File: InventoryDialog.java    From WorldGrower with GNU General Public License v3.0 5 votes vote down vote up
private void addPlayerCharacterMenuActions(JPopupMenu popupMenu, InventoryItem inventoryItem, InventoryDialogModel inventoryDialogModel, InventoryActionFactory inventoryActionFactory) {
	for(Action inventoryDialogAction : inventoryActionFactory.getPlayerCharacterInventoryActions(inventoryItem.getId())) {
		JMenuItem actionMenuItem = MenuFactory.createJMenuItem(inventoryDialogAction, soundIdReader);
		actionMenuItem.setToolTipText((String) inventoryDialogAction.getValue(Action.LONG_DESCRIPTION));
		popupMenu.add(actionMenuItem);
	}
}
 
Example 9
Source File: ManagedBeanCustomizer.java    From netbeans with Apache License 2.0 5 votes vote down vote up
private void customizeTemplatesLabelMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_customizeTemplatesLabelMouseClicked
    if (collection) {
        new OpenTemplateAction(this, NbBundle.getMessage(ManagedBeanCustomizer.class, "ManagedBeanCustomizer.tableTemplate"),
                JsfTemplateUtils.getTemplatePath(TemplateType.SNIPPETS, getTemplatesStyle(), TABLE_TEMPLATE)).actionPerformed(null);
    } else {
        JPopupMenu menu = new JPopupMenu();
        String viewTemplatePath = JsfTemplateUtils.getTemplatePath(TemplateType.SNIPPETS, getTemplatesStyle(), VIEW_TEMPLATE);
        String editTemplatePath = JsfTemplateUtils.getTemplatePath(TemplateType.SNIPPETS, getTemplatesStyle(), EDIT_TEMPLATE);
        menu.add(new OpenTemplateAction(this, NbBundle.getMessage(ManagedBeanCustomizer.class, "ManagedBeanCustomizer.allTemplates"), viewTemplatePath, editTemplatePath));
        menu.add(new OpenTemplateAction(this, NbBundle.getMessage(ManagedBeanCustomizer.class, "ManagedBeanCustomizer.viewTemplate"), viewTemplatePath));
        menu.add(new OpenTemplateAction(this, NbBundle.getMessage(ManagedBeanCustomizer.class, "ManagedBeanCustomizer.editTemplate"), editTemplatePath));
        menu.show(customizeTemplatesLabel, evt.getX(), evt.getY());
    }
}
 
Example 10
Source File: CMenuBuilder.java    From binnavi with Apache License 2.0 5 votes vote down vote up
/**
 * Adds menus related to node selection to a given node context menu.
 *
 * @param menu The node context menu to extend.
 * @param graph The graph the clicked node belongs to.
 * @param node The clicked node.
 */
public static void addSelectionMenus(
    final JPopupMenu menu, final ZyGraph graph, final NaviNode node) {
  Preconditions.checkNotNull(menu, "IE02144: Menu argument can not be null");
  Preconditions.checkNotNull(graph, "IE02145: Graph argument can not be null");
  Preconditions.checkNotNull(node, "IE02146: Node argument can not be null");

  final JMenu selectionMenu = new JMenu("Selection");

  selectionMenu.add(CActionProxy.proxy(new CActionSelectNodePredecessors(graph, node)));
  selectionMenu.add(CActionProxy.proxy(new CActionSelectNodeSuccessors(graph, node)));

  if (graph.getSelectedNodes().size() > 0) {
    selectionMenu.add(CActionProxy.proxy(new CGroupAction(graph)));
  }

  if (node.getRawNode() instanceof INaviCodeNode) {
    try {
      final INaviFunction parentFunction =
          ((INaviCodeNode) node.getRawNode()).getParentFunction();

      selectionMenu.add(CActionProxy.proxy(
          new CActionSelectSameParentFunction(graph, parentFunction)));
    } catch (final MaybeNullException exception) {
      // Obviously we can not select nodes of the same parent function if there
      // is no parent function.
    }
  } else if (node.getRawNode() instanceof INaviFunctionNode) {
    final INaviFunction function = ((INaviFunctionNode) node.getRawNode()).getFunction();

    selectionMenu.add(CActionProxy.proxy(
        new CActionSelectSameFunctionType(graph, function.getType())));
  }

  menu.add(selectionMenu);

  menu.addSeparator();
}
 
Example 11
Source File: PlaRom.java    From Logisim with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void configureMenu(JPopupMenu menu, Project proj) {
	this.circState = proj.getCircuitState();
	boolean enabled = circState != null;

	this.edit = createItem(enabled, Strings.get("ramEditMenuItem"));
	this.clear = createItem(enabled, Strings.get("ramClearMenuItem"));
	menu.addSeparator();
	menu.add(this.edit);
	menu.add(this.clear);
}
 
Example 12
Source File: CWToolsPanel.java    From wpcleaner with Apache License 2.0 5 votes vote down vote up
/**
 * Action called when Load Selection button is pressed.
 */
public void actionLoadSelection() {

  // Retrieve possible selections
  Configuration config = Configuration.getConfiguration();
  Properties properties = config.getProperties(null, Configuration.ARRAY_CHECK_BOT_SELECTION);
  if ((properties == null) || (properties.isEmpty())) {
    return;
  }
  Set<Object> keySet = properties.keySet();
  List<String> keyList = new ArrayList<String>();
  for (Object key : keySet) {
    keyList.add(key.toString());
  }
  Collections.sort(keyList);

  // Create menu
  JPopupMenu menu = new JPopupMenu();
  for (String name : keyList) {
    JMenuItem item = Utilities.createJMenuItem(name, true);
    item.setActionCommand(properties.getProperty(name));
    item.addActionListener(EventHandler.create(
        ActionListener.class, this, "actionLoadSelection", "actionCommand"));
    menu.add(item);
  }
  menu.show(
      buttonLoadSelection,
      0,
      buttonLoadSelection.getHeight());
}
 
Example 13
Source File: MemberTableMouseListener.java    From binnavi with Apache License 2.0 5 votes vote down vote up
private void showPopup(final MouseEvent event) {
  final JPopupMenu popupMenu = new JPopupMenu();
  popupMenu.add(new AddMemberAction());
  final int selectedRow = table.getSelectedRow();
  if (selectedRow != -1) {
    final MemberTableRowData row = table.getModel().getRow(selectedRow);
    popupMenu.add(new InsertMemberBeforeAction(selectedRow, row.getName()));
    popupMenu.add(new InsertMemberAfterAction(selectedRow, row.getName()));
    popupMenu.add(new DeleteMemberAction(selectedRow, row.getName()));
  }
  popupMenu.show(event.getComponent(), event.getX(), event.getY());
}
 
Example 14
Source File: DropdownButton.java    From netbeans with Apache License 2.0 5 votes vote down vote up
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);
        }
    }
}
 
Example 15
Source File: Splitter.java    From Logisim with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void configureMenu(JPopupMenu menu, Project proj) {
	menu.addSeparator();
	menu.add(new SplitterDistributeItem(proj, this, 1));
	menu.add(new SplitterDistributeItem(proj, this, -1));
}
 
Example 16
Source File: DBBrowserTree.java    From nextreports-designer with Apache License 2.0 4 votes vote down vote up
private void selectionChart(DBBrowserNode selectedNode, MouseEvent e, boolean pressed) {
	OpenChartAction openAction = new OpenChartAction();
	openAction.setChartName(selectedNode.getDBObject().getName());
	openAction.setChartPath(selectedNode.getDBObject().getAbsolutePath());

	if (e.getClickCount() == 2) {
		if (pressed) {
			openAction.actionPerformed(new ActionEvent(e.getSource(), e.getID(), ""));
		}

	} else {
		JPopupMenu popupMenu = new JPopupMenu();
		JMenuItem menuItem = new JMenuItem(openAction);
		popupMenu.add(menuItem);

		DeleteChartAction deleteAction = new DeleteChartAction(instance, selectedNode);
		JMenuItem menuItem2 = new JMenuItem(deleteAction);
		popupMenu.add(menuItem2);

		RenameChartAction renameAction = new RenameChartAction(instance, selectedNode);
		JMenuItem menuItem3 = new JMenuItem(renameAction);
		popupMenu.add(menuItem3);

		ExportChartAction exportAction = new ExportChartAction(instance, selectedNode);
		JMenuItem menuItem4 = new JMenuItem(exportAction);
		popupMenu.add(menuItem4);

		Chart chart = ChartUtil.loadChart(selectedNode.getDBObject().getAbsolutePath());
		PreviewChartAction previewHTML5Action = new PreviewChartAction(ChartRunner.GRAPHIC_FORMAT,
				ChartRunner.HTML5_TYPE, I18NSupport.getString("preview.html5"));
		previewHTML5Action.setChart(chart);
		popupMenu.add(previewHTML5Action);
		PreviewChartAction previewFlashAction = new PreviewChartAction(ChartRunner.GRAPHIC_FORMAT,
				ChartRunner.FLASH_TYPE, I18NSupport.getString("preview.flash"));
		previewFlashAction.setChart(chart);
		popupMenu.add(previewFlashAction);
		previewFlashAction.setEnabled(!ChartType.hasNoFlashSupport(chart.getType().getType()));
		PreviewChartAction previewImageAction = new PreviewChartAction(ChartRunner.IMAGE_FORMAT,
				ChartRunner.NO_TYPE, I18NSupport.getString("preview.image"));
		previewImageAction.setChart(chart);
		popupMenu.add(previewImageAction);

		PublishChartAction publishAction = new PublishChartAction(selectedNode.getDBObject().getAbsolutePath());
		JMenuItem menuItem5 = new JMenuItem(publishAction);
		popupMenu.add(menuItem5);

		JMenuItem menuItem6 = new JMenuItem(new ValidateSqlsAction(selectedNode.getDBObject()));
		popupMenu.add(menuItem6);

		JMenuItem menuItem7 = new JMenuItem(new AddToFavoritesAction(selectedNode.getDBObject()));
		popupMenu.add(menuItem7);

		popupMenu.show((Component) e.getSource(), e.getX(), e.getY());
	}
}
 
Example 17
Source File: KseFrame.java    From keystore-explorer with GNU General Public License v3.0 4 votes vote down vote up
private void initKeyStoreTabPopupMenu() {
	jpmKeyStoreTab = new JPopupMenu();

	jmiKeyStoreTabSave = new JMenuItem(saveAction);
	jmiKeyStoreTabSave.setToolTipText(null);
	new StatusBarChangeHandler(jmiKeyStoreTabSave, (String) saveAction.getValue(Action.LONG_DESCRIPTION), this);
	jpmKeyStoreTab.add(jmiKeyStoreTabSave);

	jmiKeyStoreTabSaveAll = new JMenuItem(saveAllAction);
	jmiKeyStoreTabSaveAll.setToolTipText(null);
	new StatusBarChangeHandler(jmiKeyStoreTabSaveAll, (String) saveAllAction.getValue(Action.LONG_DESCRIPTION),
			this);
	jpmKeyStoreTab.add(jmiKeyStoreTabSaveAll);

	jpmKeyStoreTab.addSeparator();

	jmiKeyStoreTabPaste = new JMenuItem(pasteAction);
	jmiKeyStoreTabPaste.setToolTipText(null);
	new StatusBarChangeHandler(jmiKeyStoreTabPaste, (String) pasteAction.getValue(Action.LONG_DESCRIPTION), this);
	jpmKeyStoreTab.add(jmiKeyStoreTabPaste);

	jpmKeyStoreTab.addSeparator();

	jmiKeyStoreTabClose = new JMenuItem(closeAction);
	jmiKeyStoreTabClose.setToolTipText(null);
	new StatusBarChangeHandler(jmiKeyStoreTabClose, (String) closeAction.getValue(Action.LONG_DESCRIPTION), this);
	jpmKeyStoreTab.add(jmiKeyStoreTabClose);

	jmiKeyStoreTabCloseOthers = new JMenuItem(closeOthersAction);
	jmiKeyStoreTabCloseOthers.setToolTipText(null);
	new StatusBarChangeHandler(jmiKeyStoreTabCloseOthers,
			(String) closeOthersAction.getValue(Action.LONG_DESCRIPTION), this);
	jpmKeyStoreTab.add(jmiKeyStoreTabCloseOthers);

	jmiKeyStoreTabCloseAll = new JMenuItem(closeAllAction);
	jmiKeyStoreTabCloseAll.setToolTipText(null);
	new StatusBarChangeHandler(jmiKeyStoreTabCloseAll, (String) closeAllAction.getValue(Action.LONG_DESCRIPTION),
			this);
	jpmKeyStoreTab.add(jmiKeyStoreTabCloseAll);

	jpmKeyStoreTab.addSeparator();

	jmiKeyStoreTabProperties = new JMenuItem(propertiesAction);
	jmiKeyStoreTabProperties.setToolTipText(null);
	new StatusBarChangeHandler(jmiKeyStoreTabProperties,
			(String) propertiesAction.getValue(Action.LONG_DESCRIPTION), this);
	jpmKeyStoreTab.add(jmiKeyStoreTabProperties);
}
 
Example 18
Source File: PolarChartPanel.java    From buffer_bci with GNU General Public License v3.0 4 votes vote down vote up
/**
 * Creates a popup menu for the panel.
 *
 * @param properties  include a menu item for the chart property editor.
 * @param save  include a menu item for saving the chart.
 * @param print  include a menu item for printing the chart.
 * @param zoom  include menu items for zooming.
 *
 * @return The popup menu.
 */
@Override
protected JPopupMenu createPopupMenu(boolean properties, boolean save,
        boolean print, boolean zoom) {

   JPopupMenu result = super.createPopupMenu(properties, save, print, zoom);
   int zoomInIndex = getPopupMenuItem(result,
           localizationResources.getString("Zoom_In"));
   int zoomOutIndex = getPopupMenuItem(result,
           localizationResources.getString("Zoom_Out"));
   int autoIndex = getPopupMenuItem(result,
           localizationResources.getString("Auto_Range"));
   if (zoom) {
       JMenuItem zoomIn = new JMenuItem(
               localizationResources.getString("Zoom_In"));
       zoomIn.setActionCommand(POLAR_ZOOM_IN_ACTION_COMMAND);
       zoomIn.addActionListener(this);

       JMenuItem zoomOut = new JMenuItem(
               localizationResources.getString("Zoom_Out"));
       zoomOut.setActionCommand(POLAR_ZOOM_OUT_ACTION_COMMAND);
       zoomOut.addActionListener(this);

       JMenuItem auto = new JMenuItem(
               localizationResources.getString("Auto_Range"));
       auto.setActionCommand(POLAR_AUTO_RANGE_ACTION_COMMAND);
       auto.addActionListener(this);

       if (zoomInIndex != -1) {
           result.remove(zoomInIndex);
       }
       else {
           zoomInIndex = result.getComponentCount() - 1;
       }
       result.add(zoomIn, zoomInIndex);
       if (zoomOutIndex != -1) {
           result.remove(zoomOutIndex);
       }
       else {
           zoomOutIndex = zoomInIndex + 1;
       }
       result.add(zoomOut, zoomOutIndex);
       if (autoIndex != -1) {
           result.remove(autoIndex);
       }
       else {
           autoIndex = zoomOutIndex + 1;
       }
       result.add(auto, autoIndex);
   }
   return result;
}
 
Example 19
Source File: ResultView.java    From netbeans with Apache License 2.0 4 votes vote down vote up
public ResultView() {
    setLayout(contentCards = new CardLayout());

    setName("Search Results");                                      //NOI18N
    setDisplayName(NbBundle.getMessage(ResultView.class, "TITLE_SEARCH_RESULTS"));    //NOI18N
    
    initAccessibility();

    pop = new JPopupMenu();
    pop.add(new Close());
    pop.add(new CloseAll());
    pop.add(new CloseAllButCurrent());
    popL = new PopupListener();
    closeL = new CloseListener();
    
    emptyPanel = new JPanel();
    singlePanel = new JPanel();
    singlePanel.setLayout(new BoxLayout(singlePanel, BoxLayout.PAGE_AXIS));
    emptyPanel.setOpaque(true);
    tabs = TabbedPaneFactory.createCloseButtonTabbedPane();
    tabs.addChangeListener(new ChangeListener() {
        @Override
        public void stateChanged(ChangeEvent e) {
            updateLookup();
        }
    });
    tabs.setMinimumSize(new Dimension(0, 0));
    tabs.addMouseListener(popL);
    tabs.addPropertyChangeListener(closeL);
    add(emptyPanel, CARD_NAME_EMPTY);
    add(tabs, CARD_NAME_TABS);
    add(singlePanel, CARD_NAME_SINGLE);
    if (isMacLaf) {
        emptyPanel.setBackground(macBackground);
        tabs.setBackground(macBackground);
        tabs.setOpaque(true);
        setBackground(macBackground);
        setOpaque(true);
    } else {
        emptyPanel.setBackground(
                UIManager.getColor("Tree.background"));         //NOI18N
    }
    contentCards.show(this, CARD_NAME_EMPTY);
    associateLookup(Lookups.proxy(lookupProvider));
}
 
Example 20
Source File: BannedUsers.java    From Spark with Apache License 2.0 2 votes vote down vote up
/**
 * Responsible for popping up the menu items.
 *
 * @param e   the MouseEvent that triggered it.
 * @param jid the JID to handle.
 */
private void showPopup(MouseEvent e, String jid) {
    final JPopupMenu popup = new JPopupMenu();
    popup.add(unBanMenuItem);
    popup.show(this, e.getX(), e.getY());
}