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 Setting the JFrame contentpane's border Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Make it so: Java DB Connections & Transactions this week in the JDBC forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Setting the JFrame contentpane Watch "Setting the JFrame contentpane New topic

Setting the JFrame contentpane's border

Chris Ramsey
Ranch Hand

Joined: Sep 15, 2003
Posts: 34
Is there a way to create an empty border on the JFrame's contentpane, so that when I add components to it the will not be placed flushed with the sides? I would like to do this without having to add a JPanel to the contentpane first. Thank you.
Nathan Pruett

Joined: Oct 18, 2000
Posts: 4121

All you have to do is cast the content pane to a JComponent and set the border...

Write once, run anywhere, because there's nowhere to hide! - /. A.C.
I agree. Here's the link:
subject: Setting the JFrame contentpane's border
It's not a secret anymore!