• Post Reply Bookmark Topic Watch Topic
  • New Topic

Setting the size of JComboBox

 
sum prit
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello everyone, i am displaying a graph in a JPanel and in the same JPanel i need to display a combobox. i could able to display them successfully, but the combobox size is bigger. Actually i am using BorderLayout, so i placed the graph at CENTER and JComboBox at NORTH. I need the size of the combobox to be smaller. I tried to use GridBagLayout also but could not able to use it. How can i manage the JComboBox to be smaller and placed above the Graph.

Thanks.
 
Rob Spoor
Sheriff
Posts: 20819
68
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Put it in a JPanel with a better layout manager (e.g. FlowLayout), then put this JPanel at BorderLayout.NORTH. Nesting components in JPanels in such a way is very common in Swing.
 
sum prit
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks a lot. Actually i tried to get it without using JPanel. I have been using 10 JPanel in CardLayout to switch with menuItem Click. And in each JPanel i used 7 JPanel. Will it be slow in displaying? Please clear my doubt.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!