Forums Register Login

Can I force components to front?

+Pie Number of slices to send: Send
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!
+Pie Number of slices to send: Send
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.

------------------
Happy Coding,
Gregg Bolinger
+Pie Number of slices to send: Send
I'd prefer a JComboBox. My list will contain approximatly 60 items....I think it would be better to see the full list.
+Pie Number of slices to send: Send
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
+Pie Number of slices to send: Send
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
+Pie Number of slices to send: Send
try this:
myContentPane().add(myJComboBox, new Integer(Integer.MAX_VALUE));
That might work. Not sure though. Have not tried it.
------------------
Happy Coding,
Gregg Bolinger
+Pie Number of slices to send: Send
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
+Pie Number of slices to send: Send
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
+Pie Number of slices to send: Send
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
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
https://gardener-gift.com


reply
reply
This thread has been viewed 1159 times.
Similar Threads
Display layer below JComboBox
Container (JPanel) refresh problem
Swing elements not displaying properly
Keeping JComboBox Visible
dropdown arrow from my combo boxes do not show on my table.
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 28, 2024 07:38:11.