This week's giveaway is in the Threads forum.
We're giving away four copies of Java Concurrency Live Lessons and have Doug Schmidt on-line!
See this thread for details.
Win a copy of Java Concurrency Live Lessons this week in the Threads forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

control / set margins  RSS feed

 
tormod eriksen
Ranch Hand
Posts: 52
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i want to design consistent layouts.
to set margins and space between components to specific values.
i try to follow the values laid out in 'Java look and feel design guideline'. (http://java.sun.com/products/jlf/ed2/book/HIG.Visual2.html)
how do i specify the margins from inside a TitledBorder to the components placed inside it?
i have tried to use GridBagLayout and to set GridBagConstraints properties such as ipadx, ipady and insets. i can make the margins larger, but not smaller. how can i get the margins smaller?
when i call the getInsets method of the TitledBorder i get the following results :
top : 21
left : 5
bottom : 5
right : 5
how can i change these?
i tried to use the getInsets(Component, Insets) method, but to no difference. (<titledborder>.getInsets(<a component added inside the border>, <new Insets(0, 0, 0, 0)> )
 
Angela Lamb
Ranch Hand
Posts: 156
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Did you try using getBorderInsets(Component c) on your TitledBorder?
 
tormod eriksen
Ranch Hand
Posts: 52
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have tried to use the getBorderInsets(Component, Insets), but I don't quite understand what function it has.
As Component I passed in the object of a component added on the component with the actual border.
As Insets I passed in new Insets(0, 0, 0, 0).
The margins looked the same, and the Insets object returned from the above method call, had the same Inserts values as the one returned from getBorderInsets(Component) (with the same component passed in as argument)
The getBorderInsets(Component) only returns a current value, it doesn't set one, right?
Does the Insets of the Component passed as argument matter?
Have I misunderstood how these methods functions and / or is to be used?
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!