Java Code Examples for javax.swing.MenuSelectionManager#clearSelectedPath()
The following examples show how to use
javax.swing.MenuSelectionManager#clearSelectedPath() .
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: SeaGlassCheckBoxMenuItemUI.java From seaglass with Apache License 2.0 | 6 votes |
public void processMouseEvent(JMenuItem item, MouseEvent e, MenuElement path[], MenuSelectionManager manager) { Point p = e.getPoint(); if (p.x >= 0 && p.x < item.getWidth() && p.y >= 0 && p.y < item.getHeight()) { if (e.getID() == MouseEvent.MOUSE_RELEASED) { manager.clearSelectedPath(); item.doClick(0); } else { manager.setSelectedPath(path); } } else if (item.getModel().isArmed()) { int c = path.length - 1; MenuElement newPath[] = new MenuElement[c]; for (int i = 0; i < c; i++) { newPath[i] = path[i]; } manager.setSelectedPath(newPath); } }
Example 2
Source File: SeaGlassRadioButtonMenuItemUI.java From seaglass with Apache License 2.0 | 6 votes |
public void processMouseEvent(JMenuItem item, MouseEvent e, MenuElement path[], MenuSelectionManager manager) { Point p = e.getPoint(); if (p.x >= 0 && p.x < item.getWidth() && p.y >= 0 && p.y < item.getHeight()) { if (e.getID() == MouseEvent.MOUSE_RELEASED) { manager.clearSelectedPath(); item.doClick(0); item.setArmed(false); } else manager.setSelectedPath(path); } else if (item.getModel().isArmed()) { MenuElement newPath[] = new MenuElement[path.length - 1]; int i, c; for (i = 0, c = path.length - 1; i < c; i++) newPath[i] = path[i]; manager.setSelectedPath(newPath); } }
Example 3
Source File: WindowsRootPaneUI.java From hottub with GNU General Public License v2.0 | 5 votes |
void altPressed(KeyEvent ev) { MenuSelectionManager msm = MenuSelectionManager.defaultManager(); MenuElement[] path = msm.getSelectedPath(); if (path.length > 0 && ! (path[0] instanceof ComboPopup)) { msm.clearSelectedPath(); menuCanceledOnPress = true; ev.consume(); } else if(path.length > 0) { // We are in ComboBox menuCanceledOnPress = false; WindowsLookAndFeel.setMnemonicHidden(false); WindowsGraphicsUtils.repaintMnemonicsInWindow(winAncestor); ev.consume(); } else { menuCanceledOnPress = false; WindowsLookAndFeel.setMnemonicHidden(false); WindowsGraphicsUtils.repaintMnemonicsInWindow(winAncestor); JMenuBar mbar = root != null ? root.getJMenuBar() : null; if(mbar == null && winAncestor instanceof JFrame) { mbar = ((JFrame)winAncestor).getJMenuBar(); } JMenu menu = mbar != null ? mbar.getMenu(0) : null; if(menu != null) { ev.consume(); } } }
Example 4
Source File: WindowsRootPaneUI.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 5 votes |
void altPressed(KeyEvent ev) { MenuSelectionManager msm = MenuSelectionManager.defaultManager(); MenuElement[] path = msm.getSelectedPath(); if (path.length > 0 && ! (path[0] instanceof ComboPopup)) { msm.clearSelectedPath(); menuCanceledOnPress = true; ev.consume(); } else if(path.length > 0) { // We are in ComboBox menuCanceledOnPress = false; WindowsLookAndFeel.setMnemonicHidden(false); WindowsGraphicsUtils.repaintMnemonicsInWindow(winAncestor); ev.consume(); } else { menuCanceledOnPress = false; WindowsLookAndFeel.setMnemonicHidden(false); WindowsGraphicsUtils.repaintMnemonicsInWindow(winAncestor); JMenuBar mbar = root != null ? root.getJMenuBar() : null; if(mbar == null && winAncestor instanceof JFrame) { mbar = ((JFrame)winAncestor).getJMenuBar(); } JMenu menu = mbar != null ? mbar.getMenu(0) : null; if(menu != null) { ev.consume(); } } }
Example 5
Source File: WindowsRootPaneUI.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
void altPressed(KeyEvent ev) { MenuSelectionManager msm = MenuSelectionManager.defaultManager(); MenuElement[] path = msm.getSelectedPath(); if (path.length > 0 && ! (path[0] instanceof ComboPopup)) { msm.clearSelectedPath(); menuCanceledOnPress = true; ev.consume(); } else if(path.length > 0) { // We are in ComboBox menuCanceledOnPress = false; WindowsLookAndFeel.setMnemonicHidden(false); WindowsGraphicsUtils.repaintMnemonicsInWindow(winAncestor); ev.consume(); } else { menuCanceledOnPress = false; WindowsLookAndFeel.setMnemonicHidden(false); WindowsGraphicsUtils.repaintMnemonicsInWindow(winAncestor); JMenuBar mbar = root != null ? root.getJMenuBar() : null; if(mbar == null && winAncestor instanceof JFrame) { mbar = ((JFrame)winAncestor).getJMenuBar(); } JMenu menu = mbar != null ? mbar.getMenu(0) : null; if(menu != null) { ev.consume(); } } }
Example 6
Source File: ComboBoxUI.java From rapidminer-studio with GNU Affero General Public License v3.0 | 5 votes |
@Override public void hide() { MenuSelectionManager manager = MenuSelectionManager.defaultManager(); MenuElement[] selection = manager.getSelectedPath(); for (MenuElement element : selection) { if (element == this) { manager.clearSelectedPath(); break; } } ComboBoxUI.this.isDown = false; this.comboBox.repaint(); }
Example 7
Source File: WindowsRootPaneUI.java From jdk8u_jdk with GNU General Public License v2.0 | 5 votes |
void altPressed(KeyEvent ev) { MenuSelectionManager msm = MenuSelectionManager.defaultManager(); MenuElement[] path = msm.getSelectedPath(); if (path.length > 0 && ! (path[0] instanceof ComboPopup)) { msm.clearSelectedPath(); menuCanceledOnPress = true; ev.consume(); } else if(path.length > 0) { // We are in ComboBox menuCanceledOnPress = false; WindowsLookAndFeel.setMnemonicHidden(false); WindowsGraphicsUtils.repaintMnemonicsInWindow(winAncestor); ev.consume(); } else { menuCanceledOnPress = false; WindowsLookAndFeel.setMnemonicHidden(false); WindowsGraphicsUtils.repaintMnemonicsInWindow(winAncestor); JMenuBar mbar = root != null ? root.getJMenuBar() : null; if(mbar == null && winAncestor instanceof JFrame) { mbar = ((JFrame)winAncestor).getJMenuBar(); } JMenu menu = mbar != null ? mbar.getMenu(0) : null; if(menu != null) { ev.consume(); } } }
Example 8
Source File: WindowsRootPaneUI.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
void altPressed(KeyEvent ev) { MenuSelectionManager msm = MenuSelectionManager.defaultManager(); MenuElement[] path = msm.getSelectedPath(); if (path.length > 0 && ! (path[0] instanceof ComboPopup)) { msm.clearSelectedPath(); menuCanceledOnPress = true; ev.consume(); } else if(path.length > 0) { // We are in ComboBox menuCanceledOnPress = false; WindowsLookAndFeel.setMnemonicHidden(false); WindowsGraphicsUtils.repaintMnemonicsInWindow(winAncestor); ev.consume(); } else { menuCanceledOnPress = false; WindowsLookAndFeel.setMnemonicHidden(false); WindowsGraphicsUtils.repaintMnemonicsInWindow(winAncestor); JMenuBar mbar = root != null ? root.getJMenuBar() : null; if(mbar == null && winAncestor instanceof JFrame) { mbar = ((JFrame)winAncestor).getJMenuBar(); } JMenu menu = mbar != null ? mbar.getMenu(0) : null; if(menu != null) { ev.consume(); } } }
Example 9
Source File: MenuButton.java From visualvm with GNU General Public License v2.0 | 5 votes |
private void hideHover() { MenuSelectionManager msm = MenuSelectionManager.defaultManager(); if (listening) { msm.removeChangeListener(this); listening = false; } msm.clearSelectedPath(); UIManager.put(CONSUME_EVENT_KEY, originalConsumeEvent); repaint(); }
Example 10
Source File: WindowsRootPaneUI.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
void altPressed(KeyEvent ev) { MenuSelectionManager msm = MenuSelectionManager.defaultManager(); MenuElement[] path = msm.getSelectedPath(); if (path.length > 0 && ! (path[0] instanceof ComboPopup)) { msm.clearSelectedPath(); menuCanceledOnPress = true; ev.consume(); } else if(path.length > 0) { // We are in ComboBox menuCanceledOnPress = false; WindowsLookAndFeel.setMnemonicHidden(false); WindowsGraphicsUtils.repaintMnemonicsInWindow(winAncestor); ev.consume(); } else { menuCanceledOnPress = false; WindowsLookAndFeel.setMnemonicHidden(false); WindowsGraphicsUtils.repaintMnemonicsInWindow(winAncestor); JMenuBar mbar = root != null ? root.getJMenuBar() : null; if(mbar == null && winAncestor instanceof JFrame) { mbar = ((JFrame)winAncestor).getJMenuBar(); } JMenu menu = mbar != null ? mbar.getMenu(0) : null; if(menu != null) { ev.consume(); } } }
Example 11
Source File: WindowsRootPaneUI.java From jdk1.8-source-analysis with Apache License 2.0 | 5 votes |
void altPressed(KeyEvent ev) { MenuSelectionManager msm = MenuSelectionManager.defaultManager(); MenuElement[] path = msm.getSelectedPath(); if (path.length > 0 && ! (path[0] instanceof ComboPopup)) { msm.clearSelectedPath(); menuCanceledOnPress = true; ev.consume(); } else if(path.length > 0) { // We are in ComboBox menuCanceledOnPress = false; WindowsLookAndFeel.setMnemonicHidden(false); WindowsGraphicsUtils.repaintMnemonicsInWindow(winAncestor); ev.consume(); } else { menuCanceledOnPress = false; WindowsLookAndFeel.setMnemonicHidden(false); WindowsGraphicsUtils.repaintMnemonicsInWindow(winAncestor); JMenuBar mbar = root != null ? root.getJMenuBar() : null; if(mbar == null && winAncestor instanceof JFrame) { mbar = ((JFrame)winAncestor).getJMenuBar(); } JMenu menu = mbar != null ? mbar.getMenu(0) : null; if(menu != null) { ev.consume(); } } }
Example 12
Source File: WindowsRootPaneUI.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
void altPressed(KeyEvent ev) { MenuSelectionManager msm = MenuSelectionManager.defaultManager(); MenuElement[] path = msm.getSelectedPath(); if (path.length > 0 && ! (path[0] instanceof ComboPopup)) { msm.clearSelectedPath(); menuCanceledOnPress = true; ev.consume(); } else if(path.length > 0) { // We are in ComboBox menuCanceledOnPress = false; WindowsLookAndFeel.setMnemonicHidden(false); WindowsGraphicsUtils.repaintMnemonicsInWindow(winAncestor); ev.consume(); } else { menuCanceledOnPress = false; WindowsLookAndFeel.setMnemonicHidden(false); WindowsGraphicsUtils.repaintMnemonicsInWindow(winAncestor); JMenuBar mbar = root != null ? root.getJMenuBar() : null; if(mbar == null && winAncestor instanceof JFrame) { mbar = ((JFrame)winAncestor).getJMenuBar(); } JMenu menu = mbar != null ? mbar.getMenu(0) : null; if(menu != null) { ev.consume(); } } }
Example 13
Source File: WindowsRootPaneUI.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
void altPressed(KeyEvent ev) { MenuSelectionManager msm = MenuSelectionManager.defaultManager(); MenuElement[] path = msm.getSelectedPath(); if (path.length > 0 && ! (path[0] instanceof ComboPopup)) { msm.clearSelectedPath(); menuCanceledOnPress = true; ev.consume(); } else if(path.length > 0) { // We are in ComboBox menuCanceledOnPress = false; WindowsLookAndFeel.setMnemonicHidden(false); WindowsGraphicsUtils.repaintMnemonicsInWindow(winAncestor); ev.consume(); } else { menuCanceledOnPress = false; WindowsLookAndFeel.setMnemonicHidden(false); WindowsGraphicsUtils.repaintMnemonicsInWindow(winAncestor); JMenuBar mbar = root != null ? root.getJMenuBar() : null; if(mbar == null && winAncestor instanceof JFrame) { mbar = ((JFrame)winAncestor).getJMenuBar(); } JMenu menu = mbar != null ? mbar.getMenu(0) : null; if(menu != null) { ev.consume(); } } }
Example 14
Source File: WindowsRootPaneUI.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
void altPressed(KeyEvent ev) { MenuSelectionManager msm = MenuSelectionManager.defaultManager(); MenuElement[] path = msm.getSelectedPath(); if (path.length > 0 && ! (path[0] instanceof ComboPopup)) { msm.clearSelectedPath(); menuCanceledOnPress = true; ev.consume(); } else if(path.length > 0) { // We are in ComboBox menuCanceledOnPress = false; WindowsLookAndFeel.setMnemonicHidden(false); WindowsGraphicsUtils.repaintMnemonicsInWindow(winAncestor); ev.consume(); } else { menuCanceledOnPress = false; WindowsLookAndFeel.setMnemonicHidden(false); WindowsGraphicsUtils.repaintMnemonicsInWindow(winAncestor); JMenuBar mbar = root != null ? root.getJMenuBar() : null; if(mbar == null && winAncestor instanceof JFrame) { mbar = ((JFrame)winAncestor).getJMenuBar(); } JMenu menu = mbar != null ? mbar.getMenu(0) : null; if(menu != null) { ev.consume(); } } }
Example 15
Source File: WindowsRootPaneUI.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
void altPressed(KeyEvent ev) { MenuSelectionManager msm = MenuSelectionManager.defaultManager(); MenuElement[] path = msm.getSelectedPath(); if (path.length > 0 && ! (path[0] instanceof ComboPopup)) { msm.clearSelectedPath(); menuCanceledOnPress = true; ev.consume(); } else if(path.length > 0) { // We are in ComboBox menuCanceledOnPress = false; WindowsLookAndFeel.setMnemonicHidden(false); WindowsGraphicsUtils.repaintMnemonicsInWindow(winAncestor); ev.consume(); } else { menuCanceledOnPress = false; WindowsLookAndFeel.setMnemonicHidden(false); WindowsGraphicsUtils.repaintMnemonicsInWindow(winAncestor); JMenuBar mbar = root != null ? root.getJMenuBar() : null; if(mbar == null && winAncestor instanceof JFrame) { mbar = ((JFrame)winAncestor).getJMenuBar(); } JMenu menu = mbar != null ? mbar.getMenu(0) : null; if(menu != null) { ev.consume(); } } }
Example 16
Source File: WindowsRootPaneUI.java From JDKSourceCode1.8 with MIT License | 5 votes |
void altPressed(KeyEvent ev) { MenuSelectionManager msm = MenuSelectionManager.defaultManager(); MenuElement[] path = msm.getSelectedPath(); if (path.length > 0 && ! (path[0] instanceof ComboPopup)) { msm.clearSelectedPath(); menuCanceledOnPress = true; ev.consume(); } else if(path.length > 0) { // We are in ComboBox menuCanceledOnPress = false; WindowsLookAndFeel.setMnemonicHidden(false); WindowsGraphicsUtils.repaintMnemonicsInWindow(winAncestor); ev.consume(); } else { menuCanceledOnPress = false; WindowsLookAndFeel.setMnemonicHidden(false); WindowsGraphicsUtils.repaintMnemonicsInWindow(winAncestor); JMenuBar mbar = root != null ? root.getJMenuBar() : null; if(mbar == null && winAncestor instanceof JFrame) { mbar = ((JFrame)winAncestor).getJMenuBar(); } JMenu menu = mbar != null ? mbar.getMenu(0) : null; if(menu != null) { ev.consume(); } } }
Example 17
Source File: WindowsRootPaneUI.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
void altPressed(KeyEvent ev) { MenuSelectionManager msm = MenuSelectionManager.defaultManager(); MenuElement[] path = msm.getSelectedPath(); if (path.length > 0 && ! (path[0] instanceof ComboPopup)) { msm.clearSelectedPath(); menuCanceledOnPress = true; ev.consume(); } else if(path.length > 0) { // We are in ComboBox menuCanceledOnPress = false; WindowsLookAndFeel.setMnemonicHidden(false); WindowsGraphicsUtils.repaintMnemonicsInWindow(winAncestor); ev.consume(); } else { menuCanceledOnPress = false; WindowsLookAndFeel.setMnemonicHidden(false); WindowsGraphicsUtils.repaintMnemonicsInWindow(winAncestor); JMenuBar mbar = root != null ? root.getJMenuBar() : null; if(mbar == null && winAncestor instanceof JFrame) { mbar = ((JFrame)winAncestor).getJMenuBar(); } JMenu menu = mbar != null ? mbar.getMenu(0) : null; if(menu != null) { ev.consume(); } } }
Example 18
Source File: WindowsRootPaneUI.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
void altPressed(KeyEvent ev) { MenuSelectionManager msm = MenuSelectionManager.defaultManager(); MenuElement[] path = msm.getSelectedPath(); if (path.length > 0 && ! (path[0] instanceof ComboPopup)) { msm.clearSelectedPath(); menuCanceledOnPress = true; ev.consume(); } else if(path.length > 0) { // We are in ComboBox menuCanceledOnPress = false; WindowsLookAndFeel.setMnemonicHidden(false); WindowsGraphicsUtils.repaintMnemonicsInWindow(winAncestor); ev.consume(); } else { menuCanceledOnPress = false; WindowsLookAndFeel.setMnemonicHidden(false); WindowsGraphicsUtils.repaintMnemonicsInWindow(winAncestor); JMenuBar mbar = root != null ? root.getJMenuBar() : null; if(mbar == null && winAncestor instanceof JFrame) { mbar = ((JFrame)winAncestor).getJMenuBar(); } JMenu menu = mbar != null ? mbar.getMenu(0) : null; if(menu != null) { ev.consume(); } } }
Example 19
Source File: WindowsRootPaneUI.java From dragonwell8_jdk with GNU General Public License v2.0 | 5 votes |
void altPressed(KeyEvent ev) { MenuSelectionManager msm = MenuSelectionManager.defaultManager(); MenuElement[] path = msm.getSelectedPath(); if (path.length > 0 && ! (path[0] instanceof ComboPopup)) { msm.clearSelectedPath(); menuCanceledOnPress = true; ev.consume(); } else if(path.length > 0) { // We are in ComboBox menuCanceledOnPress = false; WindowsLookAndFeel.setMnemonicHidden(false); WindowsGraphicsUtils.repaintMnemonicsInWindow(winAncestor); ev.consume(); } else { menuCanceledOnPress = false; WindowsLookAndFeel.setMnemonicHidden(false); WindowsGraphicsUtils.repaintMnemonicsInWindow(winAncestor); JMenuBar mbar = root != null ? root.getJMenuBar() : null; if(mbar == null && winAncestor instanceof JFrame) { mbar = ((JFrame)winAncestor).getJMenuBar(); } JMenu menu = mbar != null ? mbar.getMenu(0) : null; if(menu != null) { ev.consume(); } } }