-
Bug
-
Resolution: Fixed
-
P3
-
1.4.0, 5.0
-
b20
-
x86
-
windows_nt, windows_xp
-
Not verified
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-2152566 | 6u10 | Alexander Potochkin | P3 | Resolved | Fixed | b05 |
java version "1.5.0"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0-b64)
Java HotSpot(TM) Client VM (build 1.5.0-b64, mixed mode)
ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows XP [Version 5.1.2600]
A DESCRIPTION OF THE PROBLEM :
Run the testcase, scroll the mouse over choice 1, choice 2, choice 3 then continue vertically until the JMenuPopup has no entry selected. Now try using the keyboard arrow keys to change the menu selection. This will fail.
You can experiment and you will notice that keyboard navigation works properly until the mouse causes the JPopupMenu selection to clear (i.e. no entry selected). There is no way to bring back keyboard navigation without using the mouse.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
It should be possible to bring back menu focus, selection by using the keyboard. Use notification-area popups as an example of how this should work.
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JFrame;
import javax.swing.JMenuItem;
import javax.swing.JPopupMenu;
public class Test
{
public static void main(String[] args)
{
JFrame invoker = new JFrame();
JPopupMenu popupMenu = new JPopupMenu();
JMenuItem menuItem = new JMenuItem("choice 1");
ActionListener actionListener = new ActionListener()
{
public void actionPerformed(ActionEvent e)
{
JMenuItem menuItem = (JMenuItem) e.getSource();
System.out.println(menuItem.getText());
}
};
menuItem.addActionListener(actionListener);
popupMenu.add(menuItem);
menuItem = new JMenuItem("choice 2");
menuItem.addActionListener(actionListener);
popupMenu.add(menuItem);
menuItem = new JMenuItem("choice 3");
menuItem.addActionListener(actionListener);
popupMenu.add(menuItem);
invoker.setUndecorated(true);
invoker.setSize(popupMenu.getPreferredSize());
invoker.setVisible(true);
popupMenu.show(invoker, 0, 0);
}
}
---------- END SOURCE ----------
###@###.### 2005-1-14 23:35:49 GMT
- backported by
-
JDK-2152566 JPopupMenu keyboard navigation stops working
-
- Resolved
-
- duplicates
-
JDK-4740942 First MenuItem on JPopupMenu is Highlighted
-
- Closed
-
- relates to
-
JDK-6714611 TEST_BUG: CTE_REGTEST/Generic/4092033/Test4092033.java fails
-
- Closed
-
-
JDK-8020148 SwingUtilities.updateComponentTreeUI corrupts focus logic for JPopupMenu.
-
- Closed
-
-
JDK-6652158 javax/swing/JPopupMenu/6544309/bug6544309.java fails
-
- Closed
-
-
JDK-6653830 javax/swing/JPopupMenu/4634626/bug4634626.java fails
-
- Closed
-
-
JDK-6285881 JTrayIcon: support Swing JPopupMenus for tray icons
-
- Closed
-