• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Tim Cooke
  • Devaka Cooray
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
Bartenders:
  • Carey Brown
  • Roland Mueller

Removing panel borders

 
Ranch Hand
Posts: 54
Eclipse IDE Spring Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Rancher
Posts: 175
Clojure Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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:


 
Ranch Hand
Posts: 159
IntelliJ IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
you forgot to add this:
 
David Byron
Rancher
Posts: 175
Clojure Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 Spring Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
If you open the box, you will find Heisenberg strangling Shrodenger's cat. And waving this tiny ad:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic