Name: jk109818 Date: 02/27/2002
FULL PRODUCT VERSION :
Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.1-root-010902-18:51)
Java HotSpot(TM) Client VM (build 1.3.1, mixed mode)
FULL OPERATING SYSTEM VERSION : Windows 98 [Version 4.10.2222]
ADDITIONAL OPERATING SYSTEMS : Mac OS X 10.1.2
A DESCRIPTION OF THE PROBLEM :
When a user pops up a hierarchical menu, she should be able to drag directly to the desired item in that menu. The shortest path to the desired menu item is usually a diagonal path.
Under Swing, the user must first drag horizontally into the hierarchical menu and then drag down that menu to select the item, otherwise the hierarchical menu closes. This is very disconcerting behavior for users who are expecting the normal platform behavior (the Mac and Windows allow direct [diagonal] dragging).
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1. Create a JMenu topMenu
2. Create another JMenu hMenu and add() it to topMenu
3. Add some JMenuItems to topMenu.
4. Add some JMenuItems (say 6+) to the hMenu
5. Create a test window and menuBar and add topMenu to it
6. Try selecting the last item from hMenu
7. Compare the behavior with native apps in MacOS or Windows
EXPECTED VERSUS ACTUAL BEHAVIOR :
When the user pops up a hierarchical menu, she should be able to drag the pointer directly to the desired menu item. If you do this in Swing (and the item is not directly across) the hierarchical menu closes. Native menus allow direct (i.e. diagonal) dragging; they appear to use a timer and/or a screen region to allow this behavior.
ERROR MESSAGES/STACK TRACES THAT OCCUR :
Not Applicable. This is a user interface behavioral bug.
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
import java.awt.event.*;
import javax.swing.*;
public class BugDemo extends JFrame {
public static void main(String args[]) {
new BugDemo();
}
public BugDemo() {
super("Swing Hierarchical Menu Bug Demo");
setSize(500,300);
setJMenuBar(createMenuBar());
WindowListener windowCloser = new WindowAdapter() {
public void windowClosing(WindowEvent e) {
System.exit(0);
}
};
addWindowListener(windowCloser);
show();
}
JMenuBar createMenuBar() {
JMenuBar menuBar = new JMenuBar();
JMenu mFile = new JMenu("File");
mFile.add(createHierachicalMenu());
mFile.add(new JMenuItem("Test 1"));
mFile.add(new JMenuItem("Test 2"));
mFile.add(new JMenuItem("Test 3"));
mFile.add(new JMenuItem("Test 4"));
mFile.add(new JMenuItem("Test 5"));
mFile.add(new JMenuItem("Test 6"));
menuBar.add(mFile);
return menuBar;
}
JMenu createHierachicalMenu() {
JMenu mHierachical = new JMenu("Choose Me");
mHierachical.add(new JMenuItem("Test 7"));
mHierachical.add(new JMenuItem("Test 8"));
mHierachical.add(new JMenuItem("Test 9"));
mHierachical.add(new JMenuItem("Test A"));
mHierachical.add(new JMenuItem("Test B"));
mHierachical.add(new JMenuItem("Hi!"));
return mHierachical;
}
}
---------- END SOURCE ----------
CUSTOMER WORKAROUND :
None found.
(Review ID: 137732)
======================================================================