• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Can I force components to front?

 
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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!
 
Ranch Hand
Posts: 15304
6
Mac OS X IntelliJ IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Colleen Lynch
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'd prefer a JComboBox. My list will contain approximatly 60 items....I think it would be better to see the full list.
 
Gregg Bolinger
Ranch Hand
Posts: 15304
6
Mac OS X IntelliJ IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Colleen Lynch
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Gregg Bolinger
Ranch Hand
Posts: 15304
6
Mac OS X IntelliJ IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
try this:
myContentPane().add(myJComboBox, new Integer(Integer.MAX_VALUE));
That might work. Not sure though. Have not tried it.
------------------
Happy Coding,
Gregg Bolinger
 
Ranch Hand
Posts: 148
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Colleen Lynch
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 66
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
reply
    Bookmark Topic Watch Topic
  • New Topic