javax.swing.event.PopupMenuEvent Java Examples
The following examples show how to use
javax.swing.event.PopupMenuEvent.
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: SourceProductSelector.java From snap-desktop with GNU General Public License v3.0 | 6 votes |
@Override public void popupMenuWillBecomeVisible(PopupMenuEvent e) { JComboBox box = (JComboBox) e.getSource(); Object comp = box.getUI().getAccessibleChild(box, 0); if (!(comp instanceof JPopupMenu)) { return; } JComponent scrollPane = (JComponent) ((JPopupMenu) comp).getComponent(0); Dimension size = new Dimension(); size.width = scrollPane.getPreferredSize().width; final int boxItemCount = box.getModel().getSize(); for (int i = 0; i < boxItemCount; i++) { final JLabel label = new JLabel(); Object elementAt = box.getModel().getElementAt(i); if (elementAt != null && elementAt instanceof Product) { label.setText(((Product) elementAt).getDisplayName()); } size.width = Math.max(label.getPreferredSize().width, size.width); } size.height = scrollPane.getPreferredSize().height; scrollPane.setPreferredSize(size); scrollPane.setMaximumSize(size); }
Example #2
Source File: BoundsPopupMenuListener.java From Juicebox with MIT License | 6 votes |
/** * Alter the bounds of the popup just before it is made visible. */ @Override public void popupMenuWillBecomeVisible(PopupMenuEvent e) { @SuppressWarnings("unchecked") JComboBox<E> comboBox = (JComboBox<E>) e.getSource(); if (comboBox.getItemCount() == 0) return; final Object child = comboBox.getAccessibleContext().getAccessibleChild(0); if (child instanceof BasicComboPopup) { SwingUtilities.invokeLater(new Runnable() { public void run() { customizePopup((BasicComboPopup) child); } }); } }
Example #3
Source File: OutputTab.java From netbeans with Apache License 2.0 | 6 votes |
public void popupMenuWillBecomeInvisible(PopupMenuEvent e) { JPopupMenu popup = (JPopupMenu) e.getSource(); popup.removeAll(); popup.setInvoker(null); // hack KeyStroke esc = KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0); JComponent c = getOutputPane().getTextView(); c.getInputMap().put(esc, handle); getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).put(esc, handle); //hack end popup.removePopupMenuListener(this); for (TabAction action : popupItems) { action.clearListeners(); } }
Example #4
Source File: QuickSearch.java From netbeans with Apache License 2.0 | 5 votes |
@Override public void popupMenuWillBecomeVisible(PopupMenuEvent e) { SwingUtilities.invokeLater(new Runnable() { @Override public void run() { dummy.setVisible(false); } }); }
Example #5
Source File: DataComboBoxSupport.java From netbeans with Apache License 2.0 | 5 votes |
@Override public void popupMenuCanceled(PopupMenuEvent e) { // without the check the previous non-special item would be displayed // while calling DataComboBoxModel.newItemActionPerformed() // instead of NEW_ITEM, but this is unwanted. Same for // popupMenuWillBecomeImvisible(). if (!performingNewItemAction) { setPreviousNonSpecialItem((JComboBox)e.getSource()); } }
Example #6
Source File: DarkScrollableTabSupport.java From darklaf with MIT License | 5 votes |
public DarkScrollableTabSupport(final DarkTabbedPaneUI ui, final int tabPlacement) { super(ui); this.ui = ui; viewport = new DarkScrollableTabViewport(ui); tabPanel = new DarkScrollableTabPanel(ui); viewport.setView(tabPanel); viewport.addMouseWheelListener(this); moreTabsButton = ui.createMoreTabsButton(); moreTabsButton.setVisible(false); moreTabsButton.addActionListener(this); newTabButton = ui.createNewTabButton(); newTabButton.setVisible(PropertyUtil.getBooleanProperty(ui.tabPane, DarkTabbedPaneUI.KEY_SHOW_NEW_TAB_BUTTON)); scrollPopupMenu = new ScrollPopupMenu(UIManager.getInt(DarkTabbedPaneUI.KEY_MAX_POPUP_HEIGHT)); PopupMenuListener popupMenuListener = new PopupMenuAdapter() { @Override public void popupMenuWillBecomeInvisible(final PopupMenuEvent e) { lastClickEvent = System.currentTimeMillis(); } }; scrollPopupMenu.addPopupMenuListener(popupMenuListener); ui.tabPane.add(moreTabsButton); timer = new Timer(SCROLL_REWIND_DELAY, e -> endScroll()); timer.setRepeats(false); }
Example #7
Source File: ClientContextMenu.java From chipster with MIT License | 5 votes |
public void popupMenuWillBecomeVisible(PopupMenuEvent e) { if (selectedItem instanceof DataBean) { historyMenuItem.setEnabled(true); } else { historyMenuItem.setEnabled(false); } }
Example #8
Source File: AbstractPageListPopupListener.java From wpcleaner with Apache License 2.0 | 5 votes |
/** * This method is called before the popup menu becomes invisible * Note that a JPopupMenu can become invisible any time * * @param e Event. */ @Override public void popupMenuWillBecomeInvisible(PopupMenuEvent e) { if (list != null) { list.repaint(); } }
Example #9
Source File: PopupMenuTest.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
public void popupMenuWillBecomeInvisible(PopupMenuEvent e) { Popup popup = ((PopMenuUIExt) jpopup.getUI()).getPopup(); if (popup != null) { isLightWeight = !popup.getClass().toString(). contains("HeavyWeightPopup"); } }
Example #10
Source File: DropDownButton.java From nextreports-designer with Apache License 2.0 | 5 votes |
public void popupMenuWillBecomeInvisible(PopupMenuEvent event) { popupVisible = false; mainButton.getModel().setRollover(false); arrowButton.getModel().setSelected(false); ((JPopupMenu) event.getSource()).removePopupMenuListener(this); }
Example #11
Source File: MainPanel.java From java-swing-tips with MIT License | 5 votes |
@Override public void popupMenuWillBecomeVisible(PopupMenuEvent e) { EventQueue.invokeLater(() -> { JComboBox<?> combo = (JComboBox<?>) e.getSource(); Accessible a = combo.getAccessibleContext().getAccessibleChild(0); // Or Accessible a = combo.getUI().getAccessibleChild(combo, 0); if (a instanceof JPopupMenu) { JPopupMenu pop = (JPopupMenu) a; Point p = new Point(combo.getSize().width, 0); SwingUtilities.convertPointToScreen(p, combo); pop.setLocation(p); } }); }
Example #12
Source File: PopupMenuAdapter.java From weblaf with GNU General Public License v3.0 | 5 votes |
@Override public void popupMenuWillBecomeVisible ( final PopupMenuEvent e ) { /** * Do nothing by default. */ }
Example #13
Source File: DropDownButton.java From rapidminer-studio with GNU Affero General Public License v3.0 | 5 votes |
@Override public void popupMenuWillBecomeInvisible(PopupMenuEvent e) { popupVisible = false; mainButton.getModel().setRollover(false); arrowButton.getModel().setSelected(false); ((JPopupMenu) e.getSource()).removePopupMenuListener(this); }
Example #14
Source File: ToggleDropDownButton.java From rapidminer-studio with GNU Affero General Public License v3.0 | 5 votes |
@Override public void popupMenuWillBecomeInvisible(PopupMenuEvent e) { popupVisible = false; mainButton.getModel().setRollover(false); arrowButton.getModel().setSelected(false); ((JPopupMenu) e.getSource()).removePopupMenuListener(this); // act as good programmer :) }
Example #15
Source File: InspectAndRefactorPanel.java From netbeans with Apache License 2.0 | 5 votes |
@Override public void popupMenuWillBecomeInvisible(PopupMenuEvent e) { if (popup!=null) { popup.hide(); popup = null; } singleRefactoringCombo.getAccessibleContext().removePropertyChangeListener(listener); }
Example #16
Source File: ConfigurationsComboModel.java From netbeans with Apache License 2.0 | 4 votes |
@Override public void popupMenuWillBecomeInvisible(PopupMenuEvent e) { }
Example #17
Source File: PopupMenuTest.java From openjdk-jdk9 with GNU General Public License v2.0 | 4 votes |
public void popupMenuWillBecomeVisible(PopupMenuEvent e) { }
Example #18
Source File: GUIRegistrationPanel.java From netbeans with Apache License 2.0 | 4 votes |
public void popupMenuWillBecomeVisible(PopupMenuEvent e) { // we don't care }
Example #19
Source File: IgnoreExitListener.java From Spark-Reader with GNU General Public License v3.0 | 4 votes |
@Override public void popupMenuWillBecomeVisible(PopupMenuEvent e) { UI.tempIgnoreMouseExit = true; }
Example #20
Source File: CopyDialog.java From netbeans with Apache License 2.0 | 4 votes |
@Override public void popupMenuCanceled (PopupMenuEvent e) { popupOn = true; }
Example #21
Source File: ToolsAction.java From netbeans with Apache License 2.0 | 4 votes |
@Override public void popupMenuWillBecomeVisible(PopupMenuEvent e) { }
Example #22
Source File: ServiceDialog.java From Bytecoder with Apache License 2.0 | 4 votes |
public void popupMenuCanceled(PopupMenuEvent e) { }
Example #23
Source File: DebuggingViewComponent.java From netbeans with Apache License 2.0 | 4 votes |
@Override public void popupMenuWillBecomeVisible(PopupMenuEvent e) { popupVisible = true; }
Example #24
Source File: DebuggingViewComponent.java From netbeans with Apache License 2.0 | 4 votes |
@Override public void popupMenuWillBecomeInvisible(PopupMenuEvent e) { changeSession(selectedItem); selectedItem = null; popupVisible = false; }
Example #25
Source File: ServiceDialog.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 4 votes |
public void popupMenuWillBecomeInvisible(PopupMenuEvent e) { if (changedService) { changedService = false; updatePanels(); } }
Example #26
Source File: ServiceDialog.java From openjdk-8 with GNU General Public License v2.0 | 4 votes |
public void popupMenuWillBecomeVisible(PopupMenuEvent e) { changedService = false; }
Example #27
Source File: TopicMapGraphPanel.java From wandora with GNU General Public License v3.0 | 4 votes |
@Override public void popupMenuWillBecomeVisible(PopupMenuEvent e) { freezeForPopup=true; //popupOpen=true; }
Example #28
Source File: MenuScroller.java From Cognizant-Intelligent-Test-Scripter with Apache License 2.0 | 4 votes |
@Override public void popupMenuWillBecomeInvisible(PopupMenuEvent e) { restoreMenuItems(); }
Example #29
Source File: DropDownPopupButton.java From rapidminer-studio with GNU Affero General Public License v3.0 | 4 votes |
@Override public void popupMenuCanceled(final PopupMenuEvent e) {}
Example #30
Source File: MainProjectActionWithHistory.java From netbeans with Apache License 2.0 | 4 votes |
@Override public void popupMenuWillBecomeInvisible(PopupMenuEvent e) { }