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 Need some basic swing help.... Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Need some basic swing help...." Watch "Need some basic swing help...." New topic

Need some basic swing help....

Ben Cramphorn

Joined: May 13, 2004
Posts: 17
Basically want to add an additional label to a gui of mine. I currently have a Jpanel with box layout. Added two components, a small button panel and a table at the bottom.

What I need to do is to add a label with some text and instructions on the left hand side of the button panel but for some reason it keeps on messing up and going ontop of the button panel instead of next to it. Here is my code...

What I want is for the final appearence to look like this...

Any ideas? Also I need to keep a border of 10 between all items and need to keep the beveled outline.

Hope you can help?

Joe Vahabzadeh
Ranch Hand

Joined: Jan 05, 2005
Posts: 140
I think this would be easiest using Border Layout.

Let's say create a few JPanels:


Add your text to Instruction, add your buttons to ButtonHolder.

set Top to Border Layout. Add Instruction to the CENTER section of Top, add ButtonHolder to the LINE_END section of Top.

Add Top to the PAGE_START section of Main.

Add Table to the CENTER section of Main.

Set margins, etc., as you do currently to keep the spacing the way you like it.

That should give you what you need.
Craig Wood
Ranch Hand

Joined: Jan 14, 2004
Posts: 1535
I agree. Here's the link:
subject: Need some basic swing help....
jQuery in Action, 3rd edition