A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Swing / AWT / SWT
Setting the JFrame contentpane's border
Joined: Sep 15, 2003
Mar 26, 2004 12:08:00
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.
Joined: Oct 18, 2000
Mar 29, 2004 10:40:00
All you have to do is cast the content pane to a JComponent and set the border...
((JComponent)getContentPane()).setBorder( BorderFactory.createMatteBorder( 10, 10, 10, 10, Color.blue ) );
Write once, run anywhere, because there's nowhere to hide! - /. A.C.
Don't get me started about those stupid
subject: Setting the JFrame contentpane's border
Checking input in Dialog box before closing
Problems with GUI
Centering a JComponent in the CENTER area of BorderLayout?
how to set this a borderq
sockets in applet
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2014