src/share/classes/javax/swing/plaf/basic/BasicMenuUI.java

Print this page

        

*** 1,7 **** /* ! * Copyright (c) 1997, 2013, 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) 1997, 2014, 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
*** 607,627 **** char key = Character.toLowerCase((char)menuItem.getMnemonic()); MenuElement path[] = e.getPath(); if (key == Character.toLowerCase(e.getKeyChar())) { JPopupMenu popupMenu = ((JMenu)menuItem).getPopupMenu(); ! ArrayList newList = new ArrayList(Arrays.asList(path)); newList.add(popupMenu); MenuElement subs[] = popupMenu.getSubElements(); MenuElement sub = BasicPopupMenuUI.findEnabledChild(subs, -1, true); if(sub != null) { newList.add(sub); } MenuSelectionManager manager = e.getMenuSelectionManager(); MenuElement newPath[] = new MenuElement[0];; ! newPath = (MenuElement[]) newList.toArray(newPath); manager.setSelectedPath(newPath); e.consume(); } } --- 607,627 ---- char key = Character.toLowerCase((char)menuItem.getMnemonic()); MenuElement path[] = e.getPath(); if (key == Character.toLowerCase(e.getKeyChar())) { JPopupMenu popupMenu = ((JMenu)menuItem).getPopupMenu(); ! ArrayList<MenuElement> newList = new ArrayList<>(Arrays.asList(path)); newList.add(popupMenu); MenuElement subs[] = popupMenu.getSubElements(); MenuElement sub = BasicPopupMenuUI.findEnabledChild(subs, -1, true); if(sub != null) { newList.add(sub); } MenuSelectionManager manager = e.getMenuSelectionManager(); MenuElement newPath[] = new MenuElement[0];; ! newPath = newList.toArray(newPath); manager.setSelectedPath(newPath); e.consume(); } }