-
Type:
Bug
-
Resolution: Cannot Reproduce
-
Priority:
P3
-
None
-
Affects Version/s: 1.4.2
-
Component/s: client-libs
-
x86
-
windows_2000
Name: rmT116609 Date: 12/10/2003
FULL PRODUCT VERSION :
java version "1.4.2_01"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_01-b06)
Java HotSpot(TM) Client VM (build 1.4.2_01-b06, mixed mode)
ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows 2000 [Version 5.00.2195]
A DESCRIPTION OF THE PROBLEM :
Popup menu item tooltips are located directly over menu items if popup exceeds frame boundary. I've attached a simple example with a JFrame and a JTree that supports raising a popup menu on the tree nodes using a right-click.
If you right-click on the first node in the tree, the popup menu and its tooltips work fine. In other words, you can roll the mouse over the first choice in the popup, wait for the tooltip to show, and then move the mouse down over the other choices in the popup and the tooltips are updated and located correctly.
However, if you select a node farther down the tree such that the popup menu goes beyond the frame, the tooltip for the first and second menu items are displayed correctly, but after that the tooltip positions get all screwed up. This can prevent selection of the menu item and is annoying the heck out of my users!!!
This bug existed in Java 1.4.0_03, but has gotten worse in Java 1.4.2_01 and 1.4.2_02. Previously, the bug would only happen on popup menus that went beyond the frame boundary. All other popup menus would work fine.
However, now, in Java 1.4.2_01, once you make this happen the first time, the tooltips on popup menus that fit within the frame boundary stop working properly as well.
IF THERE IS A WORK AROUND FOR THIS BUG IT WOULD BE GREATLY APRECIATED!!!
Here is the attached example code:
import java.awt.event.*;
import javax.swing.*;
public class bug4966613 extends JFrame {
JPopupMenu mMenu;
public bug4966613() {
// Size so that popup menu can go beyond frame boundary and cause bug!!!
setSize(200, 300);
// Cresate a popup menu with 10 actions, each with a Name and Tooltip
mMenu = new JPopupMenu();
for (int i = 0; i < 10; i++) {
Action action = new AbstractAction("Choice " + i) {
public void actionPerformed(ActionEvent event) {
System.out.println("Boo");
}
};
action.putValue(Action.SHORT_DESCRIPTION,
"This is a tooltip for Choice " + i);
mMenu.add(action);
}
// Create a tree with 5 nodes and raise our popup menu on a right click
JTree tree = new JTree(new Object[] {
"Node 1", "Node 2", "Node 3", "Node 4", "Node 5"
});
tree.addMouseListener(new MouseAdapter () {
public void mouseReleased(MouseEvent e) {
if (SwingUtilities.isRightMouseButton(e)) {
mMenu.show(e.getComponent(), e.getX(), e.getY());
}
}
});
// Add the tree to our frame
getContentPane().add(tree);
}
public static void main(String[] args) {
bug4966613 frame = new bug4966613();
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setVisible(true);
}
}
REPRODUCIBILITY :
This bug can be reproduced always.
(Incident Review ID: 229508)
======================================================================