-
Bug
-
Resolution: Fixed
-
P3
-
5.0, 6
-
b92
-
generic, x86
-
generic, windows_xp
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-2148155 | 6u2 | Alexander Potochkin | P2 | Closed | Won't Fix |
Run the following test (it is also attached to the bug report):
---- BEGIN OF SOURCE CODE ----
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class NullInvoker
{
public static void main(String[] args)
{
final JFrame f = new JFrame("F");
f.setBounds(100, 100, 100, 100);
JButton b = new JButton("B");
b.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
{
JPopupMenu p = new JPopupMenu();
p.add(new JMenuItem("Item1"));
p.add(new JMenuItem("Item2"));
p.add(new JMenuItem("Item3"));
// uncomment the next line to fix the problem
// p.setInvoker(f);
p.setLocation(300, 300);
p.setVisible(true);
}
});
f.add(b);
f.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
f.setVisible(true);
}
}
---- END OF SOURCE CODE ----
When the test starts a frame with a button is shown. Click on the button to show JPopupMenu. It is not clickable and doesn't track any mouse move events to selected the proper menu item. After any item is clicked, popup is not closed.
---- BEGIN OF SOURCE CODE ----
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class NullInvoker
{
public static void main(String[] args)
{
final JFrame f = new JFrame("F");
f.setBounds(100, 100, 100, 100);
JButton b = new JButton("B");
b.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
{
JPopupMenu p = new JPopupMenu();
p.add(new JMenuItem("Item1"));
p.add(new JMenuItem("Item2"));
p.add(new JMenuItem("Item3"));
// uncomment the next line to fix the problem
// p.setInvoker(f);
p.setLocation(300, 300);
p.setVisible(true);
}
});
f.add(b);
f.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
f.setVisible(true);
}
}
---- END OF SOURCE CODE ----
When the test starts a frame with a button is shown. Click on the button to show JPopupMenu. It is not clickable and doesn't track any mouse move events to selected the proper menu item. After any item is clicked, popup is not closed.
- backported by
-
JDK-2148155 JPopupMenu behaves incorrectly with invoker being set to null
- Closed
- duplicates
-
JDK-6192557 JPopupMenu without an invoker should be treated as a desktop popup menu
- Closed
- relates to
-
JDK-6495511 Cascading popups broken in 1.6
- Closed
-
JDK-2148120 Cascading popups broken in 1.6
- Resolved
-
JDK-6285881 JTrayIcon: support Swing JPopupMenus for tray icons
- Closed