-
Bug
-
Resolution: Duplicate
-
P4
-
None
-
1.1.5
-
x86
-
windows_nt
Name: rk38400 Date: 04/11/98
This is a similar problem to bug 4114618 - but this is being dismissed as an AWT Z-ordering problem on Solaris.
Try the following bean out in the BeanBox (or in Visual Cafe.)
import com.sun.java.swing.*;
import java.awt.*;
import java.awt.event.*;
public class RootBean extends JPanel
{
JButton b;
JComboBox c;
public Container getContentPane()
{
return this; //super.getContentPane();
}
public RootBean()
{
getContentPane().setLayout(new BorderLayout());
b = new JButton("Hello");
b.addActionListener(
new ActionListener()
{
public void actionPerformed(ActionEvent e)
{
JPopupMenu pop = new JPopupMenu();
pop.setLightWeightPopupEnabled(false);
for (int i = 0; i < 10; i++)
{
pop.add(new JMenuItem("Stuff" + i));
}
pop.show(b, 0, 0);
}
});
getContentPane().add(BorderLayout.CENTER, b);
c = new JComboBox();
c.setLightWeightPopupEnabled(false);
for (int i = 0; i < 10; i++)
{
c.addItem("Stuff" + i);
}
getContentPane().add(BorderLayout.SOUTH, c);
}
}
In the beanbox, the popups only draw correctly if the bean is close enough to the edge of the BeanBoxFrame
such that JPopupMenu's popupFits() method returns false and forces creation of a HeavyWeight popup.
Mediumweight popups will not show when added to the BeanBoxFrame.
I can make the bean a subclass of JRootPane, but then my popups will (in the Beanbox) be clipped to
the bean's bounds. In other cases (such as a Visual Cafe app) they might paint correctly but mouse tracking
doesn't function properly.
It might be possible to fix BeanBox so it does the right thing - but what I'm getting at here is that a Bean
cannot really guarantee that it's container will be friendly to Swing's light and mediumweight popups -
and there needs to be a way of forcing use of heavyweight popups in all cases.
(Review ID: 26367)
======================================================================
- duplicates
-
JDK-4112982 JComboBox.setLightWeightPopupEnabled(false) fails to turn off lightweight popup
-
- Closed
-