I have a JComboBox and below it a JButton. When I try to view the contents of the combo box, it is displayed behind the button. Is there any way that I can force it to the front of the button? Thanks!
Not that I know of. However, if you are using JDK1.4, they have a component called a JSpinner that would work nicely in the comboboxes place. It just spins the objects in the text field instead of pulling down a menu and covering up other components.
Well, in that case, when you select on item on the list, the ComboBox returns back to it's textfield state. Then the buttons can be seem. So what is the problem? Does the user need to push the buttons while the combo box is dropped down? IF so, that doesn't sound like good GUI design. Could we know more about the situation? ------------------ Happy Coding, Gregg Bolinger
As I said in the first posting, when the combo box drops down, it displays behind the button. Therefore, the button is in the way of the user seeing some of the elements listed in the combo box. If my list is large then the user can scroll up or down to view the covered words, however, that would be bad GUI design. I want the whole combo box to appear over the button when it drops down. Thanks
try this: myContentPane().add(myJComboBox, new Integer(Integer.MAX_VALUE)); That might work. Not sure though. Have not tried it. ------------------ Happy Coding, Gregg Bolinger
Could u pls post ur code, because in any normal case the the list of the combobox HAS to appear over any components if they are added normally. Vinod V
Thanks for your reply... I just add the elements in the list through a simple for loop: <code> for (int i = 0; i < vec.size(); i++) { choiceBox.add(((String[])vec.get(i))[1]) } </code> I can't see how that would cause the list to display behind the button.... but I've been known to be wrong in the past! Thanks again Colleen
Would you please post the code that you use to create your gui (most importantly, the place where you add your button and combo box). I am currious to see if it is placed behind another panel. Thanks Cardwell
Post by:autobot
First, you drop a couch from the plane, THEN you surf it. Here, take this tiny ad with you:
a bit of art, as a gift, the permaculture playing cards