jQuery in Action, 2nd edition*
The moose likes Swing / AWT / SWT and the fly likes How to add two buttons in each row? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "How to add two buttons in each row?" Watch "How to add two buttons in each row?" New topic
Author

How to add two buttons in each row?

Prakher Singhal
Greenhorn

Joined: Nov 06, 2008
Posts: 2
I am trying to build one GUI and want to add two buttons in each row of a panel.
I have added my source code. This java code will add buttons in Y-AXIS (one button in each row only).

Can somebuddy help me in it?
Maneesh Godbole
Saloon Keeper

Joined: Jul 26, 2007
Posts: 10535
    
    9

Try out the GridLayout


[How to ask questions] [Donate a pint, save a life!] [Onff-turn it on!]
Prakher Singhal
Greenhorn

Joined: Nov 06, 2008
Posts: 2
Thankyou Maneesh,

I just tried GridLayout and its working fine but the size of the buttons are too big. How can I control the size of the buttons?
Michael Dunn
Ranch Hand

Joined: Jun 09, 2003
Posts: 4632
> How can I control the size of the buttons?

if you added a button to a JFrame (size 800,600),
the button would be (almost) the same size.

if you don't know how to control the size of that button,
then you need to read up on the layoutManager tutorials.

spoon-feeding you the answer to your question will not help you.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to add two buttons in each row?