• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Need some basic swing help....

 
Greenhorn
Posts: 19
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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...

http://www.rafb.net/paste/results/1HRn2O75.html

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?

Thanks..
 
Ranch Hand
Posts: 140
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I think this would be easiest using Border Layout.

Let's say create a few JPanels:

Main
Top
Instruction
ButtonHolder

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.
 
Ranch Hand
Posts: 1535
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic