-
Bug
-
Resolution: Duplicate
-
P4
-
None
-
1.1.7
-
generic
-
generic
Name: vi73552 Date: 03/31/99
Using JPopupMenu in heavyweight mode (setLightWeightPopupEnabled(false))
results in the inability of the menu to display its submenus over a
JFrame.
Steps to reproduce:
1. Create a JPopupMenu and call setLightWeightPopupEnabled(false)
on the popup.
2. Add several JMenus to the popup each containing at least 1
item.
3. Invoke the popup in a JFrame.
4. Notice that the popup doesen't display any of the submenus.
If the popup is displayed outside of the frame the submenus
will display properly.
Example code:
import javax.swing.*;
import java.awt.event.*;
public class HeavyPop implements ActionListener
{
JPopupMenu popup;
JButton btn;
JFrame frame;
JPanel panel;
JMenu menu;
public static void main(String args[])
{
HeavyPop hp = new HeavyPop();
hp.display();
}
public void display()
{
frame = new JFrame();
panel = new JPanel();
btn = new JButton("Test");
btn.addActionListener(this);
popup = new JPopupMenu();
popup.setLightWeightPopupEnabled(false);
for (int i=0; i<5; i++)
{
menu = new JMenu("menu " + i);
menu.add("item " + i);
menu.getPopupMenu().setLightWeightPopupEnabled(false);
popup.add(menu);
}
panel.add(btn);
frame.getContentPane().add(panel);
frame.setSize(600,400);
frame.setVisible(true);
}
public void actionPerformed(ActionEvent e)
{
popup.show(btn,btn.getWidth(),0);
}
}
(Review ID: 56334)
======================================================================
- duplicates
-
JDK-4188832 Medium weight submenus hidden by heavyweight Canvas
-
- Resolved
-