/*
* 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.
*/
/**
* Windows rendition of the component.
* <p>
* <strong>Warning:</strong>
* Serialized objects of this class will not be compatible with
* future Swing releases. The current serialization support is appropriate
* for short term storage or RMI between applications running the same
* version of Swing. A future release of Swing will provide support for
* long term persistence.
*/
protected boolean hotTrackingOn;
new WindowsMenuItemUIAccessor() {
public JMenuItem getMenuItem() {
return menuItem;
}
} else if (model.isRollover()
/*
* Only paint rollover if no other menu on menubar is
* selected
*/
: State.DISABLEDHOT;
for (MenuElement menuElement :
break;
}
}
}
//non top level menus have HOT state instead of PUSHED
}
}
/*
* on Vista top level menu for non active frame looks disabled
*/
}
}
return state;
}
: Part.MP_POPUPITEM;
}
};
return new WindowsMenuUI();
}
protected void installDefaults() {
super.installDefaults();
if (!WindowsLookAndFeel.isClassicWindows()) {
menuItem.setRolloverEnabled(true);
}
}
/**
* Draws the background of the menu.
* @since 1.4
*/
if (WindowsMenuItemUI.isVistaPainting()) {
return;
}
// Use superclass method for the old Windows LAF,
// for submenus, and for XP toplevel if selected or pressed
if (WindowsLookAndFeel.isClassicWindows() ||
!menu.isTopLevelMenu() ||
return;
}
// Draw a lowered bevel border
// Only paint rollover if no other menu on menubar is selected
boolean otherMenuSelected = false;
otherMenuSelected = true;
break;
}
}
if (!otherMenuSelected) {
} else {
// Draw a raised bevel border
}
}
}
}
}
/**
* Method which renders the text of the current menu item.
* <p>
* @param g Graphics context
* @param menuItem Current menu item to render
* @param textRect Bounding rectangle to render the text.
* @param text String to render
* @since 1.4
*/
if (WindowsMenuItemUI.isVistaPainting()) {
return;
}
// Only paint rollover if no other menu on menubar is selected
paintRollover = false;
break;
}
}
}
!menu.isTopLevelMenu())) ||
model.isSelected()))) {
}
}
return new WindowsMouseInputHandler();
}
/**
* This class implements a mouse handler that sets the rollover flag to
* true when the mouse enters the menu and false when it exits.
* @since 1.4
*/
super.mouseEntered(evt);
}
}
super.mouseExited(evt);
if (menu.isRolloverEnabled()) {
model.setRollover(false);
}
}
}
int defaultTextIconGap) {
// Note: When toolbar containers (rebars) are implemented, only do
// this if the JMenuBar is not in a rebar (i.e. ignore the desktop
// property win.menu.height if in a rebar.)
d.height = menuBarHeight;
}
return d;
}
}