Duplicate :
|
|
Relates :
|
|
Relates :
|
|
Relates :
|
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.
|