61 static MnemonicListener mnemonicListener = null; 62 static final Object GUTTER_OFFSET_KEY = 63 new StringUIClientPropertyKey("GUTTER_OFFSET_KEY"); 64 65 public static ComponentUI createUI(JComponent c) { 66 return new WindowsPopupMenuUI(); 67 } 68 69 public void installListeners() { 70 super.installListeners(); 71 if (! UIManager.getBoolean("Button.showMnemonics") && 72 mnemonicListener == null) { 73 74 mnemonicListener = new MnemonicListener(); 75 MenuSelectionManager.defaultManager(). 76 addChangeListener(mnemonicListener); 77 } 78 } 79 80 /** 81 * Returns the <code>Popup</code> that will be responsible for 82 * displaying the <code>JPopupMenu</code>. 83 * 84 * @param popupMenu JPopupMenu requesting Popup 85 * @param x Screen x location Popup is to be shown at 86 * @param y Screen y location Popup is to be shown at. 87 * @return Popup that will show the JPopupMenu 88 * @since 1.4 89 */ 90 public Popup getPopup(JPopupMenu popupMenu, int x, int y) { 91 PopupFactory popupFactory = PopupFactory.getSharedInstance(); 92 return popupFactory.getPopup(popupMenu.getInvoker(), popupMenu, x, y); 93 } 94 95 static class MnemonicListener implements ChangeListener { 96 JRootPane repaintRoot = null; 97 98 public void stateChanged(ChangeEvent ev) { 99 MenuSelectionManager msm = (MenuSelectionManager)ev.getSource(); 100 MenuElement[] path = msm.getSelectedPath(); 101 if (path.length == 0) { 102 if(!WindowsLookAndFeel.isMnemonicHidden()) { | 61 static MnemonicListener mnemonicListener = null; 62 static final Object GUTTER_OFFSET_KEY = 63 new StringUIClientPropertyKey("GUTTER_OFFSET_KEY"); 64 65 public static ComponentUI createUI(JComponent c) { 66 return new WindowsPopupMenuUI(); 67 } 68 69 public void installListeners() { 70 super.installListeners(); 71 if (! UIManager.getBoolean("Button.showMnemonics") && 72 mnemonicListener == null) { 73 74 mnemonicListener = new MnemonicListener(); 75 MenuSelectionManager.defaultManager(). 76 addChangeListener(mnemonicListener); 77 } 78 } 79 80 /** 81 * Returns the {@code Popup} that will be responsible for 82 * displaying the {@code JPopupMenu}. 83 * 84 * @param popupMenu JPopupMenu requesting Popup 85 * @param x Screen x location Popup is to be shown at 86 * @param y Screen y location Popup is to be shown at. 87 * @return Popup that will show the JPopupMenu 88 * @since 1.4 89 */ 90 public Popup getPopup(JPopupMenu popupMenu, int x, int y) { 91 PopupFactory popupFactory = PopupFactory.getSharedInstance(); 92 return popupFactory.getPopup(popupMenu.getInvoker(), popupMenu, x, y); 93 } 94 95 static class MnemonicListener implements ChangeListener { 96 JRootPane repaintRoot = null; 97 98 public void stateChanged(ChangeEvent ev) { 99 MenuSelectionManager msm = (MenuSelectionManager)ev.getSource(); 100 MenuElement[] path = msm.getSelectedPath(); 101 if (path.length == 0) { 102 if(!WindowsLookAndFeel.isMnemonicHidden()) { |