Package javax.swing

Examples of javax.swing.MenuSelectionManager


                WindowsLookAndFeel.setMnemonicHidden(true);
                WindowsGraphicsUtils.repaintMnemonicsInWindow(winAncestor);
                return;
            }

            MenuSelectionManager msm =
                MenuSelectionManager.defaultManager();
            if (msm.getSelectedPath().length == 0) {
                // if no menu is active, we try activating the menubar

                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) {
                    MenuElement[] path = new MenuElement[2];
                    path[0] = mbar;
                    path[1] = menu;
                    msm.setSelectedPath(path);
                } else if(!WindowsLookAndFeel.isMnemonicHidden()) {
                    WindowsLookAndFeel.setMnemonicHidden(true);
                    WindowsGraphicsUtils.repaintMnemonicsInWindow(winAncestor);
                }
            } else {
                if((msm.getSelectedPath())[0] instanceof ComboPopup) {
                    WindowsLookAndFeel.setMnemonicHidden(true);
                    WindowsGraphicsUtils.repaintMnemonicsInWindow(winAncestor);
                }
            }
View Full Code Here


                    return true;
                } else if (ev.getID() == KeyEvent.KEY_RELEASED) {
                    if (altKeyPressed) {
                        altReleased(ev);
                    } else {
                        MenuSelectionManager msm =
                            MenuSelectionManager.defaultManager();
                        MenuElement[] path = msm.getSelectedPath();
                        if (path.length <= 0) {
                            WindowsLookAndFeel.setMnemonicHidden(true);
                            WindowsGraphicsUtils.repaintMnemonicsInWindow(winAncestor);
                        }
                    }
View Full Code Here

        return result;
    }

    protected void doClick(final MenuSelectionManager msm) {
        MenuSelectionManager manager = (msm != null) ? msm : MenuSelectionManager.defaultManager();
        manager.clearSelectedPath();
        final BasicLookAndFeel lookAndFeel = (BasicLookAndFeel)UIManager.getLookAndFeel();
        lookAndFeel.fireSoundAction(menuItem, getPropertyPrefix() + ".commandSound");
        menuItem.doClick(0);
    }
View Full Code Here


public class BasicMenuItemUI extends MenuItemUI {
    protected class MouseInputHandler implements MouseInputListener {
        public void mouseEntered(final MouseEvent e) {
            final MenuSelectionManager manager = MenuSelectionManager.defaultManager();
            if (openMenuTimer != null) {
                openMenuTimer.stop();
            }
            manager.setSelectedPath(Utilities.addToPath(manager.getSelectedPath(), menuItem));
        }
View Full Code Here

            }
            manager.setSelectedPath(Utilities.addToPath(manager.getSelectedPath(), menuItem));
        }

        public void mouseExited(final MouseEvent e) {
            final MenuSelectionManager manager = MenuSelectionManager.defaultManager();
            manager.setSelectedPath(Utilities.removeFromPath(manager.getSelectedPath(), menuItem));
        }
View Full Code Here

            final MenuSelectionManager manager = MenuSelectionManager.defaultManager();
            manager.setSelectedPath(Utilities.removeFromPath(manager.getSelectedPath(), menuItem));
        }

        public void mouseReleased(final MouseEvent e) {
            MenuSelectionManager defaultManager = MenuSelectionManager.defaultManager();
            if (defaultManager.componentForPoint(e.getComponent(), e.getPoint()) == menuItem
                    || Utilities.isEmptyArray(defaultManager.getSelectedPath())) {

                doClick(defaultManager);
            } else {
                defaultManager.processMouseEvent(e);
            }
        }
View Full Code Here

        }
    }

    protected class MouseInputHandler implements MouseInputListener {
        public void mouseEntered(final MouseEvent e) {
            final MenuSelectionManager manager = MenuSelectionManager.defaultManager();
            if (!manager.isComponentPartOfCurrentMenu(menuItem)) {
                return;
            }
            if (Utilities.isEmptyArray(manager.getSelectedPath())) {
                return;
            }
            if (!menuItem.isEnabled()) {
                return;
            }
            if (openMenuTimer != null) {
                openMenuTimer.stop();
            }
            final JMenu menu = (JMenu)menuItem;
            MenuElement[] path = Utilities.addToPath(manager.getSelectedPath(), menu);
            if (menu.isTopLevelMenu()) {
                path = Utilities.addToPath(path, menu.getPopupMenu());
                manager.setSelectedPath(path);
                OPEN_POPUP_ACTION.openPopup(menu);
            } else {
                manager.setSelectedPath(path);
                setupPostTimer(menu);
            }
        }
View Full Code Here

            }
        }

        public void mousePressed(final MouseEvent e) {
            final JMenu menu = (JMenu)menuItem;
            MenuSelectionManager defaultManager = MenuSelectionManager.defaultManager();
            if (menu.isTopLevelMenu()) {
                if (Utilities.isEmptyArray(defaultManager.getSelectedPath())) {
                    defaultManager.setSelectedPath(new MenuElement[] {(JMenuBar)menu.getParent(), menu});
                    OPEN_POPUP_ACTION.openPopup(menu);
                } else {
                    defaultManager.clearSelectedPath();
                }
            }
        }
View Full Code Here

                }
            }
        }

        public void mouseReleased(final MouseEvent e) {
            MenuSelectionManager defaultManager = MenuSelectionManager.defaultManager();
            if (defaultManager.componentForPoint(e.getComponent(), e.getPoint()) == null) {
                defaultManager.clearSelectedPath();
            } else {
                defaultManager.processMouseEvent(e);
            }
        }
View Full Code Here

        return result;
    }

    protected void doClick(final MenuSelectionManager msm) {
        MenuSelectionManager manager = (msm != null) ? msm : MenuSelectionManager.defaultManager();
        manager.clearSelectedPath();
        final BasicLookAndFeel lookAndFeel = (BasicLookAndFeel)UIManager.getLookAndFeel();
        lookAndFeel.fireSoundAction(menuItem, getPropertyPrefix() + ".commandSound");
        menuItem.doClick(0);
    }
View Full Code Here

TOP

Related Classes of javax.swing.MenuSelectionManager

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.