|
Replies:
2
-
Last Post:
Aug 12, 2008 4:05 AM
by: egon_olsen
|
|
|
|
|
|
|
Horizontal Sizing of Custom Component
Posted:
Aug 11, 2008 2:16 AM
|
|
|
Hello,
I am trying to write a custom Component that expands horizontally, i.e. uses as much horizontal space as the Layout Manager is willing to give but only so much that horizontal padding and margins still occur.
Overwriting calcPreferredSize and setSize is not enough, though. If I let calcPreferredSize return a width larger than the Display then setSize still does not get called with a smaller value for width.
Is there another method I have to overwrite?
Kind regards and thanks for the effort in answering the forum requests.
|
|
|
|
|
|
|
Re: Horizontal Sizing of Custom Component
Posted:
Aug 11, 2008 5:57 AM
in response to: egon_olsen
|
|
|
Hello,
Generally it is up to the layout manager to do what you want. You should return a preferred size in getPreferredSize, but if you want the component to be as wide as possible you should make the LayoutManager understand that that is what you want.
Also make sure that you return large numbers for getMaximumSize().
Cheers, Mikael Grev www.miglayout.com
|
|
|
|
|
|
|
|
Re: Horizontal Sizing of Custom Component
Posted:
Aug 12, 2008 4:05 AM
in response to: mikaelgrev
|
|
|
Thanks Mikael.
|
|
|
|
|