-
Bug
-
Resolution: Cannot Reproduce
-
P4
-
None
-
1.3.1, 1.4.0
-
x86
-
linux
Name: gm110360 Date: 11/30/2001
java version "1.3.1"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.1-b24)
Java HotSpot(TM) Client VM (build 1.3.1-b24, mixed mode)
PopupMenus do not work correctly under Linux (Red Hat 7.1). The popup menu
appears correctly and you can select menu items, but no ActionEvents are sent.
This occurs only under Linux - it works correctly under Windows. Also, the
problem only occurs for "top level" menu items. If the PopupMenu contains a
submenu, the menu items in that submenu do work correctly.
The following program demonstrates the problem.
import java.awt.*;
import java.awt.event.*;
public class PopupTest extends Canvas implements ActionListener
{
PopupMenu menu;
public static void main(String args[])
{
Frame f = new Frame();
PopupTest c = new PopupTest();
Menu submenu = new Menu("Submenu");
MenuItem item1 = new MenuItem("This doesn't work");
MenuItem item2 = new MenuItem("This works");
f.add(c, BorderLayout.CENTER);
c.menu = new PopupMenu();
c.add(c.menu);
c.menu.add(item1);
c.menu.add(submenu);
submenu.add(item2);
item1.addActionListener(c);
item2.addActionListener(c);
c.enableEvents(AWTEvent.MOUSE_EVENT_MASK);
f.pack();
f.show();
}
public void processMouseEvent(MouseEvent ev)
{
if (ev.isPopupTrigger())
menu.show(this, ev.getPoint().x, ev.getPoint().y);
}
public void actionPerformed(ActionEvent ev)
{
System.out.println("Action Performed");
}
public Dimension getPreferredSize()
{
return new Dimension(100, 100);
}
}
I believe this bug is identical to 4394847 (although the person who submitted
that one did not specify what operating system they were using, which is
probably why it could not be reproduced). That bug is marked as fixed, but the
fix described there is for a completely different, unrelated bug. The problem
which was fixed involved popup menus not appearing, whereas in my case (and in
the case of the person who submitted that bug), the menus DO appear, but fail
to generate ActionEvents.
(Review ID: 136388)
======================================================================
- relates to
-
JDK-4916223 PopupMenus do not remain showing after mouse click on Unix platforms
-
- Closed
-