309 |
if (i) if this menu is a submenu in some other menu |
if (i) if this menu is a submenu in some other menu |
310 |
(ii) or if this menu is in a menu bar and some other menu in a menu bar was just |
(ii) or if this menu is in a menu bar and some other menu in a menu bar was just |
311 |
selected. (If nothing was selected, menu should be pressed before |
selected. (If nothing was selected, menu should be pressed before |
312 |
it will be selected) |
it will be selected) |
313 |
*/ |
*/ |
314 |
JMenu menu = (JMenu) menuItem; |
JMenu menu = (JMenu) menuItem; |
315 |
if (! menu.isTopLevelMenu() |
if (! menu.isTopLevelMenu() |
338 |
MenuSelectionManager manager = MenuSelectionManager.defaultManager(); |
MenuSelectionManager manager = MenuSelectionManager.defaultManager(); |
339 |
JMenu menu = (JMenu) menuItem; |
JMenu menu = (JMenu) menuItem; |
340 |
manager.processMouseEvent(e); |
manager.processMouseEvent(e); |
341 |
|
|
342 |
// Menu should be displayed when the menu is pressed only if |
// Menu should be displayed when the menu is pressed only if |
343 |
// it is top-level menu |
// it is top-level menu |
344 |
if (menu.isTopLevelMenu()) |
if (menu.isTopLevelMenu()) |
345 |
{ |
{ |
346 |
if (menu.getPopupMenu().isVisible()) |
if (menu.getPopupMenu().isVisible()) |
347 |
// If menu is visible and menu button was pressed.. |
// If menu is visible and menu button was pressed.. |
348 |
// then need to cancel the menu |
// then need to cancel the menu |
349 |
manager.clearSelectedPath(); |
manager.clearSelectedPath(); |
350 |
else |
else |
351 |
{ |
{ |
352 |
// Display the menu |
// Display the menu |