Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

How to display two JComboBoxes side by side?  RSS feed

 
S Connor
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, I am trying to display two JComboBoxes side by side. I can successfully display them as part of a BorderLayout if they are in the North and East, but when I try to display them side by side in the same area, eg North, only one of the combo boxes gets displayed.
 
Maneesh Godbole
Bartender
Posts: 11445
18
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
S Connor wrote:Hi, I am trying to display two JComboBoxes side by side. I can successfully display them as part of a BorderLayout if they are in the North and East, but when I try to display them side by side in the same area, eg North, only one of the combo boxes gets displayed.

3 possible solutions off the top of my head
1) Try adding them to the WEST and EAST
2) Create a JPanel, add the combo boxes to it and the add the panel to NORTH
3) Drop the borderlayout. Use FlowLayout with CENTER alignment and then add the combo boxes to it.
 
S Connor
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This worked a treat thanks.
 
Maneesh Godbole
Bartender
Posts: 11445
18
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You are welcome!
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!