[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

Using Swing's JComboBox...

Posted on 1998-04-06
3
Medium Priority
?
235 Views
Last Modified: 2008-03-06
I am having trouble with the JComboBox from Swing.  I have a combo box on one of my panels.  I have added a few items to the combo box.  When I run the app, and try to select an item from the combo box, the popup list of items does not appear.  Why is this, and how can I fix it?
0
Comment
Question by:stepma
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 5

Expert Comment

by:fontaine
ID: 1233945
Maybe are you using both AWT and Swing components. This is not recommended. If you are adding the JComboBox to a Panel, try using a JPanel instead. If this is not the problem, it is difficult to make a diagnosis without taking a look at the code...
0
 

Author Comment

by:stepma
ID: 1233946
I am using a JPanel...Here is the code:

val_sph = new JComboBox(items);
            val_sph.setSelectedIndex(0);
            val_sph.setLightWeightPopupEnabled(false);
            val_sph.setEditable(false);
            add(val_sph);

I have gotten it to work by adding setLightWeightPopupEnabled(false);
Why is this?
0
 
LVL 1

Accepted Solution

by:
mnelson051997 earned 100 total points
ID: 1233947
Is your JComboBox at the bottom of the panel?  If so, making the
popup heavy will allow it to display outside the panel.  This would
explain why it shows up when you use setLightWeightPopupEnabled(false).
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Java functions are among the best things for programmers to work with as Java sites can be very easy to read and prepare. Java especially simplifies many processes in the coding industry as it helps integrate many forms of technology and different d…
In this post we will learn different types of Android Layout and some basics of an Android App.
Video by: Michael
Viewers learn about how to reduce the potential repetitiveness of coding in main by developing methods to perform specific tasks for their program. Additionally, objects are introduced for the purpose of learning how to call methods in Java. Define …
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.
Suggested Courses

649 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question