|
Re: setMinimumSize() does nothing [message #200944 is a reply to message #200929] |
Fri, 28 October 2005 12:27 |
Eclipse User |
|
|
|
Originally posted by: Lamont_Gilbert.rigidsoftware.com
Michael Pradel wrote:
> Hi,
>
> I'm trying to create a figure with a minimum size:
>
> Figure f = new Figure();
> f.setMinimumSize(new Dimension(50,50));
> f.setBorder(new LineBorder());
> f.setLayoutManager(new FlowLayout());
>
> All I get as result is a little black point, so I assume that the figure
> has not (50,50), but (0,0) as size.
>
> What is missing here? Thanks for any ideas!
I believe minimum and maximum are preferences ysed by layout managers.
They dont actually restrict direct sizing. If you want to restrict size
do it in the edit policy or edit part.
CL
|
|
|
Re: setMinimumSize() does nothing [message #201123 is a reply to message #200929] |
Sat, 29 October 2005 10:43 |
Eclipse User |
|
|
|
Originally posted by: mvsteenbergen.eljakim.scratch-this.nl
Your figure's final size is determined by its parent figure's layout
manager; not the figure's own layout manager. Make sure that the parent
figure actually has a layout manager and that it uses the figure's
minimum size to computer the final size.
Regards,
Martijn.
Michael Pradel wrote:
> Hi,
>
> I'm trying to create a figure with a minimum size:
>
> Figure f = new Figure();
> f.setMinimumSize(new Dimension(50,50));
> f.setBorder(new LineBorder());
> f.setLayoutManager(new FlowLayout());
>
> All I get as result is a little black point, so I assume that the figure
> has not (50,50), but (0,0) as size.
>
> What is missing here? Thanks for any ideas!
|
|
|
|
Re: setMinimumSize() does nothing [message #201577 is a reply to message #201127] |
Wed, 02 November 2005 00:20 |
Eclipse User |
|
|
|
Originally posted by: none.unknown.com
Your figure should be returning a preferred size that is at least as big as
the minimum size. ToolbarLayout only respects the minimum size in the minor
dimension. Some other layouts might completely ignore the minimum size.
It's better to use the preferred size to size your figures. In your case,
the flow layout is determining what the preferred size of f will be. Since
f has no children, just a border, it returns a preferred size of (2,2). If
you add a few figures to f (and set their sizes to some random size), you'll
see that f grows accordingly. If you want f to have a minimum size even
when it's empty, override FlowLayout's calculatePreferredSize() and union
super.calculatePreferredSize() with figure.getMinimumSize().
"Michael Pradel" <michael@binaervarianz.de> wrote in message
news:djvm8t$mt5$1@news.eclipse.org...
> Thanks for the hint.
>
> > Your figure's final size is determined by its parent figure's layout
> > manager; not the figure's own layout manager. Make sure that the parent
> > figure actually has a layout manager and that it uses the figure's
> > minimum size to computer the final size.
>
> Setting to layout manager of the parent figure to ToolbarLayout should
> not compress the inner figure smaller than their minimum size.
> However, the following snippet shows me a black line at the top of the
> figure instead of a rectangle:
>
> Figure contents = new Figure();
> contents.setLayoutManager(new ToolbarLayout());
> Figure f = new Figure();
> f.setMinimumSize(new Dimension(50,50));
> f.setBorder(new LineBorder());
> f.setLayoutManager(new FlowLayout());
> contents.add(f);
>
> Any ideas why? Thanks.
|
|
|
|
Powered by
FUDForum. Page generated in 0.04057 seconds