This week's book giveaway is in the Java 8 forum.
We're giving away four copies of Java 8 in Action and have Raoul-Gabriel Urma, Mario Fusco, and Alan Mycroft on-line!
See this thread for details.
The moose likes Swing / AWT / SWT and the fly likes Understanding box layouts? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Understanding box layouts?" Watch "Understanding box layouts?" New topic

Understanding box layouts?

John Corkrend
Ranch Hand

Joined: Oct 27, 2012
Posts: 51

I've recently tried to use the box layout and I couldn't get it to work quite properly.

When attempting to implement the box layout, I couldn't understand this bit of code. What exactly is the container, my window, a JPanel. And then what is int. Those were the first two things I ran in to.

Here is the basic code of fake program, but the way I have the code organized is the same way I would in a real program.

Rob Camick
Ranch Hand

Joined: Jun 13, 2009
Posts: 2095
How to Use Box Layout
Maneesh Godbole
Saloon Keeper

Joined: Jul 26, 2007
Posts: 9993

John Corkrend wrote:I've recently tried to use the box layout and I couldn't get it to work quite properly.

Its always a good idea to keep the API docs handy. The Java API has excellent comments. Many times it also links to the "How to use xxx" articles like the one Rob posted.

[How to ask questions] [Donate a pint, save a life!] [Onff-turn it on!]
I agree. Here's the link:
subject: Understanding box layouts?
Similar Threads
Very Very New
Getting text from JTextField/JComboBox?
Help with actionlisteners on a button.
Visibility help?