• Post Reply Bookmark Topic Watch Topic
  • New Topic

A question anoying me  RSS feed

 
Lei Xiaowen
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello:
If I want to creat three buttons ,the three buttons are not in a horizon
line ,but in a vertical line .How to write codes?
thanks
LeiXiaowen(China)
 
Swati Udas
Ranch Hand
Posts: 121
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try using gridBagLayout
assign gridbagconstraints for each button
and give gridx=0 for all 3 buttons
gridy= 0, 1, 2 respectively for the 3 buttons
 
Michael Dunn
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
add them to a panel set as GridLayout 3 rows, 1 column

something like this

 
Qunfeng Wang
Ranch Hand
Posts: 434
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Or use JGoodies FormLayout.
It's a layout very easy to use.You can go here: www.jgoodies.com for more details.
I'm from China too. This do be a good place for you to learn java and practise your english.
Good luck!
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!