Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
The moose likes Swing / AWT / SWT and the fly likes Space around my BorderLayout Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Space around my BorderLayout" Watch "Space around my BorderLayout" New topic

Space around my BorderLayout

Greg Funston
Ranch Hand

Joined: Feb 09, 2011
Posts: 81


I have designed a GUI within a Jframe. It has a Borderlayout inside with 3 panels. A top panel a bottom panel and a center panel with a JScrollpanel. I like my GUI except for one thing. It goes all the way to the edge of my JFrame. Is there a simple way to have an inset or margin from the frame. I would appreciate any ideas.


Greg Funston SCJP
Maneesh Godbole
Saloon Keeper

Joined: Jul 26, 2007
Posts: 10825

You can try setting an empty border around the component.
Check out BorderFactory#createEmptyBorder(int top,int left,int bottom,int right)

[How to ask questions] [Donate a pint, save a life!] [Onff-turn it on!]
Greg Funston
Ranch Hand

Joined: Feb 09, 2011
Posts: 81


It was exactly what I was looking for. I saw it when I was looking through the API but had dismissed it
without realizing it was adjustable.

Greg Funston SCJP :
I agree. Here's the link:
subject: Space around my BorderLayout
It's not a secret anymore!