Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Swing spacing question  RSS feed

 
Barry Brashear
Ranch Hand
Posts: 303
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a question on spacing between swing components. Our stype guide
state :

Allow at least 15px of padding between the bottom of the buttons and the
bottom of the window

How does a java developer translate pixels into something that can be coded
in spacing in a java program?

Thanks.
 
Craig Wood
Ranch Hand
Posts: 1535
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Insets properties are given in pixels. Check for them in the index in the javadocs to get an idea of where they might be useful to you. Also, you can use an empty border, for JComponents, which takes pixel arguments. See BorderFactory api. Certain layout managers use pixel–specified component padding, eg, check the fields hgap and vgap in the FlowLayout and BorderLayout apis.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!