File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Swing / AWT / SWT and the fly likes Componet Allignment Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Componet Allignment" Watch "Componet Allignment" New topic
Author

Componet Allignment

Chase Becicka
Greenhorn

Joined: Feb 16, 2004
Posts: 23
I am having a problem being able to get my botton Jbuttons to allign properly, they are just lined up in a row at the bottom of my JFrame but I want it to appear more like

NextCust NextAcct Search
Add Update Delete Exit


Craig Wood
Ranch Hand

Joined: Jan 14, 2004
Posts: 1535
What we can do to get this kind of layout

Options and possibilities:
1 — add the buttons in each row to a separate JPanel with FlowLayout and add these two JPanels to buttonPanel with a GridLayout(2,0) or a BorderLayout (using north and south sections)

2 – you could use the two JPanels but try a GridLayout in each JPanel instead of FlowLayout. One of the GridLayout constructors has an hgap and vgap option.

3 — again with the two JPanels you could try a GridBagLayout or a BoxLayout in each one. These two layout managers are more advanced...
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: Componet Allignment