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)> )
Did you try using getBorderInsets(Component c) on your TitledBorder?
posted 17 years ago
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?