This week's book giveaway is in the Design forum.
We're giving away four copies of Building Microservices and have Sam Newman on-line!
See this thread for details.
The moose likes Swing / AWT / SWT and the fly likes Simple JFrame formatting... Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Building Microservices this week in the Design forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Simple JFrame formatting..." Watch "Simple JFrame formatting..." New topic

Simple JFrame formatting...

Adam Ellsworth

Joined: Sep 25, 2004
Posts: 21
Im making a simple program and have probably a fairly simple question. My problem is, I want one of my JButtons/TextArea above my legendArea but it keeps coming up to the left of it. Is there any command to create a break of somesort? Any help would be appreciated Thanks.
Michael Dunn
Ranch Hand

Joined: Jun 09, 2003
Posts: 4632
Are you adding them to a JPanel?
If so, the default layout is a FlowLayout, so they will go from left to right (depending on widths).
Change the layout of the panel to BorderLayout, then add to NORTH and CENTER

something like this (aircode - expect a typo or two)

I agree. Here's the link:
subject: Simple JFrame formatting...
jQuery in Action, 3rd edition