< prev index next >
src/java.desktop/macosx/classes/com/apple/laf/AquaMenuUI.java
Print this page
*** 1,7 ****
/*
! * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
--- 1,7 ----
/*
! * Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
*** 94,111 ****
class MenuDragMouseHandler implements MenuDragMouseListener {
public void menuDragMouseDragged(final MenuDragMouseEvent e) {
if (menuItem.isEnabled() == false) return;
final MenuSelectionManager manager = e.getMenuSelectionManager();
! final MenuElement path[] = e.getPath();
// In Aqua, we always respect the menu's delay, if one is set.
// Doesn't matter how the menu is clicked on or otherwise moused over.
final Point p = e.getPoint();
if (p.x >= 0 && p.x < menuItem.getWidth() && p.y >= 0 && p.y < menuItem.getHeight()) {
final JMenu menu = (JMenu)menuItem;
! final MenuElement selectedPath[] = manager.getSelectedPath();
if (!(selectedPath.length > 0 && selectedPath[selectedPath.length - 1] == menu.getPopupMenu())) {
if (menu.getDelay() == 0) {
appendPath(path, menu.getPopupMenu());
} else {
manager.setSelectedPath(path);
--- 94,111 ----
class MenuDragMouseHandler implements MenuDragMouseListener {
public void menuDragMouseDragged(final MenuDragMouseEvent e) {
if (menuItem.isEnabled() == false) return;
final MenuSelectionManager manager = e.getMenuSelectionManager();
! final MenuElement[] path = e.getPath();
// In Aqua, we always respect the menu's delay, if one is set.
// Doesn't matter how the menu is clicked on or otherwise moused over.
final Point p = e.getPoint();
if (p.x >= 0 && p.x < menuItem.getWidth() && p.y >= 0 && p.y < menuItem.getHeight()) {
final JMenu menu = (JMenu)menuItem;
! final MenuElement[] selectedPath = manager.getSelectedPath();
if (!(selectedPath.length > 0 && selectedPath[selectedPath.length - 1] == menu.getPopupMenu())) {
if (menu.getDelay() == 0) {
appendPath(path, menu.getPopupMenu());
} else {
manager.setSelectedPath(path);
*** 122,132 ****
public void menuDragMouseExited(final MenuDragMouseEvent e) { }
public void menuDragMouseReleased(final MenuDragMouseEvent e) { }
}
static void appendPath(final MenuElement[] path, final MenuElement elem) {
! final MenuElement newPath[] = new MenuElement[path.length + 1];
System.arraycopy(path, 0, newPath, 0, path.length);
newPath[path.length] = elem;
MenuSelectionManager.defaultManager().setSelectedPath(newPath);
}
--- 122,132 ----
public void menuDragMouseExited(final MenuDragMouseEvent e) { }
public void menuDragMouseReleased(final MenuDragMouseEvent e) { }
}
static void appendPath(final MenuElement[] path, final MenuElement elem) {
! final MenuElement[] newPath = new MenuElement[path.length + 1];
System.arraycopy(path, 0, newPath, 0, path.length);
newPath[path.length] = elem;
MenuSelectionManager.defaultManager().setSelectedPath(newPath);
}
*** 142,152 ****
public void mouseEntered(final MouseEvent e) {
final JMenu menu = (JMenu)menuItem;
if (!menu.isEnabled()) return;
final MenuSelectionManager manager = MenuSelectionManager.defaultManager();
! final MenuElement selectedPath[] = manager.getSelectedPath();
// In Aqua, we always have a menu delay, regardless of where the menu is.
if (!(selectedPath.length > 0 && selectedPath[selectedPath.length - 1] == menu.getPopupMenu())) {
// the condition below prevents from activating menu in other frame
if (!menu.isTopLevelMenu() || (selectedPath.length > 0 &&
--- 142,152 ----
public void mouseEntered(final MouseEvent e) {
final JMenu menu = (JMenu)menuItem;
if (!menu.isEnabled()) return;
final MenuSelectionManager manager = MenuSelectionManager.defaultManager();
! final MenuElement[] selectedPath = manager.getSelectedPath();
// In Aqua, we always have a menu delay, regardless of where the menu is.
if (!(selectedPath.length > 0 && selectedPath[selectedPath.length - 1] == menu.getPopupMenu())) {
// the condition below prevents from activating menu in other frame
if (!menu.isTopLevelMenu() || (selectedPath.length > 0 &&
< prev index next >