Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Removing panel borders

 
Chris Zaremba
Ranch Hand
Posts: 54
Eclipse IDE Linux Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Suddenly my application has come together and I'm just going through cleaning everything up for submission but I've hit on a problem. The following code is an example



I want to get rid of the margin/inset/padding shown in green in the example screen shot to get the left sides of the text boxes to line up. I've tried adding empty borders and a few other things but can't get rid of it.



Does anyone have an answer?
swing.jpg
[Thumbnail for swing.jpg]
Example Screen Shot
 
David Byron
Rancher
Posts: 175
Clojure Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Chris Zaremba wrote:I want to get rid of the margin/inset/padding shown in green in the example screen shot to get the left sides of the text boxes to line up. I've tried adding empty borders and a few other things but can't get rid of it.


According to the API, there's a constructor that allows you to specify those gaps:
The API wrote:
FlowLayout(int align, int hgap, int vgap)
Creates a new flow layout manager with the indicated alignment and the indicated horizontal and vertical gaps.


Try:


 
Dennis Grimbergen
Ranch Hand
Posts: 159
IntelliJ IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
you forgot to add this:
 
David Byron
Rancher
Posts: 175
Clojure Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dennis Grimbergen wrote:you forgot to add this:

The green margin is actually occurring on topPanel, which has a FlowLayout, not on TestingMargin, which has a GridBagLayout. So importing java.awt.Insets and then specifying

actually has no effect whatsoever on his unwanted space.
 
Chris Zaremba
Ranch Hand
Posts: 54
Eclipse IDE Linux Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you very much. The hgap and vgap settings do control this. It's easy when you know what you're looking for.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic