File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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
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...
It's not a secret anymore!