/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/**
* A default L&F implementation of MenuUI. This implementation
* is a "combined" view/controller.
*
* @author Georges Saab
* @author David Karlton
* @author Arnaud Weber
*/
{
/** Uses as the parent of the windowInputMap when selected. */
/* diagnostic aids -- should be false for production builds. */
private static boolean crossMenuMnemonic = true;
return new BasicMenuUI();
}
}
protected void installDefaults() {
super.installDefaults();
}
return "Menu";
}
protected void installListeners() {
super.installListeners();
if (changeListener == null)
if (changeListener != null)
if (menuListener == null)
if (menuListener != null)
}
protected void installKeyboardActions() {
super.installKeyboardActions();
}
void installLazyActionMap() {
getPropertyPrefix() + ".actionMap");
}
void updateMnemonicBinding() {
"Menu.shortcutKeys");
if (shortcutKeys == null) {
}
if (mnemonic == lastMnemonic) {
return;
}
for (int shortcutKey : shortcutKeys) {
(lastMnemonic, shortcutKey, false));
}
}
if (mnemonic != 0) {
if (windowInputMap == null) {
}
for (int shortcutKey : shortcutKeys) {
shortcutKey, false), "selectMenu");
}
}
}
protected void uninstallKeyboardActions() {
super.uninstallKeyboardActions();
lastMnemonic = 0;
}
return getHandler();
}
return null;
}
return null;
}
return getHandler();
}
}
return handler;
}
protected void uninstallDefaults() {
menuItem.setSelected(false);
super.uninstallDefaults();
}
protected void uninstallListeners() {
super.uninstallListeners();
if (changeListener != null)
if (menuListener != null)
menuListener = null;
}
return getHandler();
}
return (MenuKeyListener)getHandler();
}
Dimension d = c.getPreferredSize();
}
return null;
}
timer.setRepeats(false);
}
}
// NOTE: This will be null if the action is registered in the
// ActionMap. For the timer use it will be non-null.
private boolean force=false;
super(key);
this.force = shouldForce;
}
}
return menu;
}
if (!crossMenuMnemonic) {
return;
}
}
if(force) {
MenuElement me[];
} else {
}
}
} else {
}
}
}
if (c instanceof JMenu) {
}
return true;
}
}
/*
* Set the background color depending on whether this is a toplevel menu
* in a menubar or a submenu of another menu.
*/
private void updateDefaultBackgroundColor() {
return;
}
if (menu.isTopLevelMenu()) {
} else {
}
}
}
/**
* Instantiated and used by a menu item to handle the current menu selection
* from mouse events. A MouseInputHandler processes and forwards all mouse events
* to a shared instance of the MenuSelectionManager.
* <p>
* This class is protected so that it can be subclassed by other look and
* feels to implement their own mouse handling behavior. All overridden
* methods should call the parent methods so that the menu selection
* is correct.
*
* @see javax.swing.MenuSelectionManager
* @since 1.4
*/
// NOTE: This class exists only for backward compatability. All
// its functionality has been moved into Handler. If you need to add
// new functionality add it to the Handler, but make sure this
// class calls into the Handler.
getHandler().mouseClicked(e);
}
/**
* Invoked when the mouse has been clicked on the menu. This
* method clears or sets the selection path of the
* MenuSelectionManager.
*
* @param e the mouse event
*/
getHandler().mousePressed(e);
}
/**
* Invoked when the mouse has been released on the menu. Delegates the
* mouse event to the MenuSelectionManager.
*
* @param e the mouse event
*/
getHandler().mouseReleased(e);
}
/**
* Invoked when the cursor enters the menu. This method sets the selected
* path for the MenuSelectionManager and handles the case
* in which a menu item is used to pop up an additional menu, as in a
* hierarchical menu system.
*
* @param e the mouse event; not used
*/
getHandler().mouseEntered(e);
}
getHandler().mouseExited(e);
}
/**
* Invoked when a mouse button is pressed on the menu and then dragged.
* Delegates the mouse event to the MenuSelectionManager.
*
* @param e the mouse event
* @see java.awt.event.MouseMotionListener#mouseDragged
*/
getHandler().mouseDragged(e);
}
getHandler().mouseMoved(e);
}
}
/**
* As of Java 2 platform 1.4, this previously undocumented class
* is now obsolete. KeyBindings are now managed by the popup menu.
*/
public boolean isSelected = false;
menu = m;
}
}
//
// PropertyChangeListener
//
if (e.getPropertyName() == AbstractButton.
}
else {
}
super.propertyChange(e);
}
}
//
// MouseInputListener
//
}
/**
* Invoked when the mouse has been clicked on the menu. This
* method clears or sets the selection path of the
* MenuSelectionManager.
*
* @param e the mouse event
*/
return;
if(menu.isTopLevelMenu()) {
} else {
}
}
}
if(menu.isTopLevelMenu() ||
} else {
}
}
}
/**
* Invoked when the mouse has been released on the menu. Delegates the
* mouse event to the MenuSelectionManager.
*
* @param e the mouse event
*/
return;
if (!e.isConsumed())
}
/**
* Invoked when the cursor enters the menu. This method sets the selected
* path for the MenuSelectionManager and handles the case
* in which a menu item is used to pop up an additional menu, as in a
* hierarchical menu system.
*
* @param e the mouse event; not used
*/
// only disable the menu highlighting if it's disabled and the property isn't
// true. This allows disabled rollovers to work in WinL&F
return;
}
if (!menu.isTopLevelMenu()) {
menu.getPopupMenu())) {
} else {
}
}
} else {
// A top level menu's parent is by definition
// a JMenuBar
}
}
}
}
}
/**
* Invoked when a mouse button is pressed on the menu and then dragged.
* Delegates the mouse event to the MenuSelectionManager.
*
* @param e the mouse event
* @see java.awt.event.MouseMotionListener#mouseDragged
*/
return;
}
}
//
// MenuDragHandler
//
return;
menu.getPopupMenu())) {
if(menu.isTopLevelMenu() ||
} else {
}
}
}
}
//
// MenuKeyListener
//
/**
* Open the Menu
*/
// when crossMenuMnemonic is not set, we don't open a toplevel
// menu if another toplevel menu is already open
return;
}
//Fix 6939261: to return in case not on the main menu
//and has a pop-up.
//after return code will be handled in BasicPopupMenuUI.java
return;
}
}
e.consume();
}
}
}
}