Methods Summary |
---|
private static void | appendPath(javax.swing.MenuElement[] path, javax.swing.MenuElement elem)
MenuElement newPath[] = new MenuElement[path.length+1];
System.arraycopy(path, 0, newPath, 0, path.length);
newPath[path.length] = elem;
MenuSelectionManager.defaultManager().setSelectedPath(newPath);
|
protected javax.swing.event.ChangeListener | createChangeListener(javax.swing.JComponent c)
return null;
|
protected javax.swing.event.MenuDragMouseListener | createMenuDragMouseListener(javax.swing.JComponent c)
return getHandler();
|
protected javax.swing.event.MenuKeyListener | createMenuKeyListener(javax.swing.JComponent c)
return (MenuKeyListener)getHandler();
|
protected javax.swing.event.MenuListener | createMenuListener(javax.swing.JComponent c)
return null;
|
protected javax.swing.event.MouseInputListener | createMouseInputListener(javax.swing.JComponent c)
return getHandler();
|
protected java.beans.PropertyChangeListener | createPropertyChangeListener(javax.swing.JComponent c)
return getHandler();
|
public static javax.swing.plaf.ComponentUI | createUI(javax.swing.JComponent x)
return new BasicMenuUI();
|
javax.swing.plaf.basic.BasicMenuItemUI$Handler | getHandler()
if (handler == null) {
handler = new Handler();
}
return handler;
|
public java.awt.Dimension | getMaximumSize(javax.swing.JComponent c)
if (((JMenu)menuItem).isTopLevelMenu() == true) {
Dimension d = c.getPreferredSize();
return new Dimension(d.width, Short.MAX_VALUE);
}
return null;
|
protected java.lang.String | getPropertyPrefix()
return "Menu";
|
protected void | installDefaults()
super.installDefaults();
updateDefaultBackgroundColor();
((JMenu)menuItem).setDelay(200);
crossMenuMnemonic = UIManager.getBoolean("Menu.crossMenuMnemonic");
|
protected void | installKeyboardActions()
super.installKeyboardActions();
updateMnemonicBinding();
|
void | installLazyActionMap()
LazyActionMap.installLazyActionMap(menuItem, BasicMenuUI.class,
getPropertyPrefix() + ".actionMap");
|
protected void | installListeners()
super.installListeners();
if (changeListener == null)
changeListener = createChangeListener(menuItem);
if (changeListener != null)
menuItem.addChangeListener(changeListener);
if (menuListener == null)
menuListener = createMenuListener(menuItem);
if (menuListener != null)
((JMenu)menuItem).addMenuListener(menuListener);
|
static void | loadActionMap(javax.swing.plaf.basic.LazyActionMap map)
BasicMenuItemUI.loadActionMap(map);
map.put(new Actions(Actions.SELECT, null, true));
|
protected void | setupPostTimer(javax.swing.JMenu menu)
Timer timer = new Timer(menu.getDelay(), new Actions(
Actions.SELECT, menu,false));
timer.setRepeats(false);
timer.start();
|
protected void | uninstallDefaults()
menuItem.setArmed(false);
menuItem.setSelected(false);
menuItem.resetKeyboardActions();
super.uninstallDefaults();
|
protected void | uninstallKeyboardActions()
super.uninstallKeyboardActions();
lastMnemonic = 0;
|
protected void | uninstallListeners()
super.uninstallListeners();
if (changeListener != null)
menuItem.removeChangeListener(changeListener);
if (menuListener != null)
((JMenu)menuItem).removeMenuListener(menuListener);
changeListener = null;
menuListener = null;
handler = null;
|
private void | updateDefaultBackgroundColor()
if (!UIManager.getBoolean("Menu.useMenuBarBackgroundForTopLevel")) {
return;
}
JMenu menu = (JMenu)menuItem;
if (menu.getBackground() instanceof UIResource) {
if (menu.isTopLevelMenu()) {
menu.setBackground(UIManager.getColor("MenuBar.background"));
} else {
menu.setBackground(UIManager.getColor(getPropertyPrefix() + ".background"));
}
}
|
void | updateMnemonicBinding()
int mnemonic = menuItem.getModel().getMnemonic();
int[] shortcutKeys = (int[])DefaultLookup.get(menuItem, this,
"Menu.shortcutKeys");
if (shortcutKeys == null) {
shortcutKeys = new int[] {KeyEvent.ALT_MASK};
}
if (mnemonic == lastMnemonic) {
return;
}
InputMap windowInputMap = SwingUtilities.getUIInputMap(
menuItem, JComponent.WHEN_IN_FOCUSED_WINDOW);
if (lastMnemonic != 0 && windowInputMap != null) {
for (int i=0; i<shortcutKeys.length; i++) {
windowInputMap.remove(KeyStroke.getKeyStroke
(lastMnemonic, shortcutKeys[i], false));
}
}
if (mnemonic != 0) {
if (windowInputMap == null) {
windowInputMap = createInputMap(JComponent.
WHEN_IN_FOCUSED_WINDOW);
SwingUtilities.replaceUIInputMap(menuItem, JComponent.
WHEN_IN_FOCUSED_WINDOW, windowInputMap);
}
for (int i=0; i<shortcutKeys.length; i++) {
windowInputMap.put(KeyStroke.getKeyStroke(mnemonic,
shortcutKeys[i], false),
"selectMenu");
}
}
lastMnemonic = mnemonic;
|