javax.swing.JPopupMenu.Separator Java Examples
The following examples show how to use
javax.swing.JPopupMenu.Separator.
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: LogAxisPlotDemo2.java From jtk with Apache License 2.0 | 6 votes |
public static JPanel makeScaleOptionPanel(){ // create the side panel with scale change options JPanel optionPanel = new JPanel(); optionPanel.add(Box.createVerticalStrut(20)); optionPanel.setLayout(new BoxLayout(optionPanel,BoxLayout.Y_AXIS)); optionPanel.add(makeScalePanel(pv1,"View (0,0)")); optionPanel.add(Box.createVerticalStrut(20)); optionPanel.add(new Separator()); optionPanel.add(makeScalePanel(pv2,"View (0,1)")); optionPanel.add(Box.createVerticalStrut(20)); optionPanel.add(new Separator()); optionPanel.add(makeScalePanel(pv3,"View (1,0)")); optionPanel.add(Box.createVerticalStrut(20)); optionPanel.add(new Separator()); optionPanel.add(makeScalePanel(pv4,"View (1,1)")); optionPanel.add(Box.createVerticalStrut(20)); return optionPanel; }
Example #2
Source File: AbstractPopupMenu.java From radiance with BSD 3-Clause "New" or "Revised" License | 4 votes |
void addMenuSeparator() { Separator separator = new Separator(); separator.setFocusable(false); this.menuComponents.add(separator); this.fireStateChanged(); }
Example #3
Source File: NewFile.java From netbeans with Apache License 2.0 | 4 votes |
@Messages({ "LBL_NewFileAction_File_PopupName=Other...", "NewFile.please_wait=Please wait..." }) private void fillSubMenu(final JMenu menuItem, final Lookup lookup) { menuItem.removeAll(); JMenuItem wait = new JMenuItem(NewFile_please_wait()); wait.setEnabled(false); menuItem.add(wait); final Pair<List<Project>, List<FileObject>> data = ActionsUtil.mineFromLookup(lookup); RP.post(new Runnable() { @Override public void run() { Project projects[] = ActionsUtil.getProjects(data); final Project project = projects.length > 0 ? projects[0] : null; final List<TemplateItem> items = OpenProjectList.prepareTemplates(project, getLookup()); EventQueue.invokeLater(new Runnable() { @Override public void run() { menuItem.removeAll(); ActionListener menuListener = new PopupListener(); for (TemplateItem i : items) { JMenuItem item = new JMenuItem( LBL_NewFileAction_Template_PopupName(i.displayName), i.icon); item.addActionListener(menuListener); item.putClientProperty(TEMPLATE_PROPERTY, i.template); item.putClientProperty(IN_PROJECT_PROPERTY, project != null); menuItem.add(item); } if (!items.isEmpty()) { menuItem.add(new Separator()); } JMenuItem fileItem = new JMenuItem(LBL_NewFileAction_File_PopupName(), (Icon) getValue(Action.SMALL_ICON)); fileItem.addActionListener(menuListener); fileItem.putClientProperty(TEMPLATE_PROPERTY, null); fileItem.putClientProperty(IN_PROJECT_PROPERTY, project != null); menuItem.add(fileItem); // #205616 - need to refresh please wait node menuItem.getPopupMenu().pack(); } }); } }); }
Example #4
Source File: GlobalCacheManagerMenu.java From IrScrutinizer with GNU General Public License v3.0 | 4 votes |
protected final void setup() { for (MenuElement me : globalCacheMenu.getSubElements()) { if (AbstractButton.class.isInstance(me)) { buttonGroup.remove((AbstractButton) me); } } globalCacheMenu.removeAll(); globalCacheRadioButtons = new JRadioButton[GlobalCacheManager.getInstance().getAutomatic().length + GlobalCacheManager.getInstance().getManual().length]; InetAddress[] automaticGlobalCaches = GlobalCacheManager.getInstance().getAutomatic(); InetAddress[] manualGlobalCaches = GlobalCacheManager.getInstance().getManual(); int index = 0; for (InetAddress ipName : manualGlobalCaches) { addGlobalCache(index, ipName.getHostName(), ipName, "Manually entered GlobalCache."); index++; } if (automaticGlobalCaches.length > 0 && manualGlobalCaches.length > 0) globalCacheMenu.add(new Separator()); String[] automaticGlobalCachesPretty = GlobalCacheManager.getInstance().getAutomaticPrettyNames(); for (int i = 0; i < automaticGlobalCaches.length; i++) { addGlobalCache(index, automaticGlobalCachesPretty[i], automaticGlobalCaches[i], "Automatically discovered GlobalCache."); index++; } globalCacheMenu.add(new Separator()); JMenuItem manualAddMenuItem = new JMenuItem("Add manually..."); manualAddMenuItem.setMnemonic('A'); globalCacheMenu.add(manualAddMenuItem); manualAddMenuItem.addActionListener((java.awt.event.ActionEvent evt) -> { try { String ip = guiUtils.getInput("Enter GlobalCache IP-Name or -address", "GlobalCache entry", GlobalCache.defaultGlobalCacheIP); if (ip != null) GlobalCacheManager.getInstance().addManualGlobalCache(InetAddress.getByName(ip)); } catch (UnknownHostException ex) { guiUtils.error(ex); } }); globalCacheMenu.repaint(); globalCacheMenu.getParent().repaint(); }
Example #5
Source File: PlayStoreViewBuilder.java From raccoon4 with Apache License 2.0 | 4 votes |
@Override protected JPanel assemble() { blankloader = new ImageIcon(new BufferedImage(43, 11, BufferedImage.TYPE_INT_ARGB)); JPanel panel = new JPanel(); panel.setLayout(new BorderLayout()); GridBagConstraints gbc = new GridBagConstraints(); sidebar = new JPanel(); sidebar.setLayout(new CardLayout()); sidebar.add( new OverviewBuilder().withBorder(BorderFactory.createEtchedBorder()) .build(globals), WELCOME); sidebar.setPreferredSize(new Dimension(450, 700)); serp = new JPanel(); serp.setLayout(new CardLayout()); serp.add(new JPanel(), WELCOME); serp.setPreferredSize(new Dimension(550, 700)); query = new JTextField(20); query.setMargin(new Insets(2, 2, 2, 2)); search = new JButton(Messages.getLocalizer().localize("search")); query.addActionListener(this); search.addActionListener(this); query.requestFocusInWindow(); JPanel container = new JPanel(); container.setLayout(new GridBagLayout()); busy = new JLabel(blankloader); busy.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); gbc.gridx = 0; gbc.gridy = 0; gbc.fill = GridBagConstraints.NONE; gbc.anchor = GridBagConstraints.CENTER; gbc.insets = new Insets(0, 30, 0, 30); container.add(busy, gbc); gbc.gridx = 1; gbc.gridy = 0; gbc.fill = GridBagConstraints.HORIZONTAL; gbc.anchor = GridBagConstraints.CENTER; gbc.weightx = 1; gbc.insets = new Insets(0, 0, 0, 5); container.add(query, gbc); gbc.gridx = 2; gbc.gridy = 0; gbc.fill = GridBagConstraints.NONE; gbc.anchor = GridBagConstraints.EAST; gbc.weightx = 0; gbc.insets = new Insets(0, 0, 0, 0); container.add(search, gbc); gbc.gridx = 0; gbc.gridy = 1; gbc.gridwidth = 3; gbc.anchor = GridBagConstraints.CENTER; gbc.fill = GridBagConstraints.BOTH; gbc.insets = new Insets(5, 10, 10, 0); container.add(new JSeparator(Separator.HORIZONTAL), gbc); gbc.gridx = 0; gbc.gridy = 2; gbc.gridwidth = 3; gbc.anchor = GridBagConstraints.CENTER; gbc.fill = GridBagConstraints.BOTH; gbc.weightx = 1; gbc.weighty = 1; gbc.insets = new Insets(10, 10, 0, 0); container.add(serp, gbc); panel.add(container); panel.add(sidebar, BorderLayout.WEST); globals.get(PlayManager.class).addPlayListener(this); globals.get(BridgeManager.class).addBridgeListener(this); globals.get(DatabaseManager.class).get(VariableDao.class) .addDataSetListener(new DatasetListenerProxy(this)); globals.get(DatabaseManager.class).get(PlayProfileDao.class) .subscribe(new DatasetListenerProxy(this)); Focus.on(query); return panel; }
Example #6
Source File: ContactListTreeCellRenderer.java From jitsi with Apache License 2.0 | 4 votes |
/** * Shows the appropriate user interface that would allow the user to add * the given <tt>SourceUIContact</tt> to their contact list. * * @param contact the contact to add */ private void addContact(SourceUIContact contact) { SourceContact sourceContact = (SourceContact) contact.getDescriptor(); List<ContactDetail> details = sourceContact.getContactDetails( OperationSetPersistentPresence.class); int detailsCount = details.size(); if (detailsCount > 1) { JMenuItem addContactMenu = TreeContactList.createAddContactMenu( (SourceContact) contact.getDescriptor()); JPopupMenu popupMenu = ((JMenu) addContactMenu).getPopupMenu(); // Add a title label. JLabel infoLabel = new JLabel(); infoLabel.setText("<html><b>" + GuiActivator.getResources() .getI18NString("service.gui.ADD_CONTACT") + "</b></html>"); popupMenu.insert(infoLabel, 0); popupMenu.insert(new Separator(), 1); popupMenu.setFocusable(true); popupMenu.setInvoker(treeContactList); Point location = new Point(addContactButton.getX(), addContactButton.getY() + addContactButton.getHeight()); SwingUtilities.convertPointToScreen(location, treeContactList); location.y = location.y + treeContactList.getPathBounds(treeContactList.getSelectionPath()).y; popupMenu.setLocation(location.x + 8, location.y - 8); popupMenu.setVisible(true); } else if (details.size() == 1) { TreeContactList.showAddContactDialog( details.get(0), sourceContact.getDisplayName()); } }