Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Setting the JFrame contentpane's border

 
Chris Ramsey
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Bartender
Posts: 4121
IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
All you have to do is cast the content pane to a JComponent and set the border...
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic