Known problem with JComboBox?  
Author Message
Rene Ruppert





PostPosted: 2005-2-16 19:13:00 Top

java-programmer, Known problem with JComboBox? Hi,

just wondering if this is a known problem:
I have to set JComboBox.setLightWeightPopupEnabled(false) due to the
constellation of my framework.
Now the scrollbar of the combo won't be updated as long as the box is
entirely displayed within my JFrame. As soon as part of it is out of the
window the scrollbar will work.

What's that all about? Is there a "semi lightweight mode" or something like
that?

Thanks.

Ren?


 
Rene Ruppert





PostPosted: 2005-2-16 20:15:00 Top

java-programmer >> Known problem with JComboBox? Hmmm....just wrote a little test up and in there it works...what the heck
could that be? I'm using a JFrame with JInternalFrames and a GlassPane to
simulate modal dialogs.

Here's the test app that shows the correct behaviour...maybe someone has an
ideas of how to modify it to make it NOT work so I can track down the bug.
:-(

import javax.swing.*;
import java.awt.*;

public class Test extends JFrame
{
public Test()
{
super("Test");
setSize(500, 400);
setVisible(true);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

Object[] items = new Object[100];
for(int i = 0; i < items.length; ++i)
{
items[i] = new String("Eintrag " + i);
}

setLayout(null);
JComboBox comboBox = new JComboBox(items);
comboBox.setLightWeightPopupEnabled(false);
comboBox.setSize(320, 20);
comboBox.setLocation(30, 30);
getContentPane().add(comboBox);


repaint();
}

public static void main(String arguments[])
{
Test test = new Test();
}
}