From: Sam Takoy on
Hi,

I'm writing a custom layout manager and here's what I don't understand.

My experience tells that, generally speaking, there are two modes of
layout. One, when the layout happens for the first time and all elements
assume the size that they would most like.

In the second mode, when the user resizes the JFrame, all elements
inside just need to deal.

So, in layoutContainer(Container parent), how do I know what mode it is?

I guess the difference b/w the two modes is that in the former, I tell
the parent what size to become. In the latter, the parent tells its
children what size it wants to be.

So how do I tell?

Many thanks in advance,

Sam
From: Jeff Higgins on
On 6/8/2010 8:13 PM, Sam Takoy wrote:
> Hi,
>
> I'm writing a custom layout manager and here's what I don't understand.
>
> My experience tells that, generally speaking, there are two modes of
> layout.

Please be specific.

> One, when the layout happens for the first time and all elements
> assume the size that they would most like.
>
> In the second mode, when the user resizes the JFrame, all elements
> inside just need to deal.
>
> So, in layoutContainer(Container parent), how do I know what mode it is?
>
> I guess the difference b/w the two modes is that in the former, I tell
> the parent what size to become. In the latter, the parent tells its
> children what size it wants to be.

Please provide a pointer to the description of these modes in the
documentation for the specific framework with which you are working.

>
> So how do I tell?

Read the documentation?

>
> Many thanks in advance,
>
> Sam

From: Sam Takoy on
On 6/8/2010 9:20 PM, Jeff Higgins wrote:
> On 6/8/2010 8:13 PM, Sam Takoy wrote:
>> Hi,
>>
>> I'm writing a custom layout manager and here's what I don't understand.
>>
>> My experience tells that, generally speaking, there are two modes of
>> layout.
>
> Please be specific.

Read my question
From: Gene on
On Jun 8, 8:13 pm, Sam Takoy <sam.ta...(a)yahoo.com> wrote:
> Hi,
>
> I'm writing a custom layout manager and here's what I don't understand.
>
> My experience tells that, generally speaking, there are two modes of
> layout. One, when the layout happens for the first time and all elements
> assume the size that they would most like.
>
> In the second mode, when the user resizes the JFrame, all elements
> inside just need to deal.
>
> So, in layoutContainer(Container parent), how do I know what mode it is?
>
> I guess the difference b/w the two modes is that in the former, I tell
> the parent what size to become. In the latter, the parent tells its
> children what size it wants to be.
>
> So how do I tell?
>
> Many thanks in advance,
>
> Sam

This doesn't make much sense. The layout must take a given container
size and lay out/resize the contained components to fit. This is the
pack() operation. Whether the container is being drawn initially or
after a resize makes no difference at all.
From: Sam Takoy on
On 6/8/2010 10:29 PM, Gene wrote:
> On Jun 8, 8:13 pm, Sam Takoy<sam.ta...(a)yahoo.com> wrote:
>> Hi,
>>
>> I'm writing a custom layout manager and here's what I don't understand.
>>
>> My experience tells that, generally speaking, there are two modes of
>> layout. One, when the layout happens for the first time and all elements
>> assume the size that they would most like.
>>
>> In the second mode, when the user resizes the JFrame, all elements
>> inside just need to deal.
>>
>> So, in layoutContainer(Container parent), how do I know what mode it is?
>>
>> I guess the difference b/w the two modes is that in the former, I tell
>> the parent what size to become. In the latter, the parent tells its
>> children what size it wants to be.
>>
>> So how do I tell?
>>
>> Many thanks in advance,
>>
>> Sam
>
> This doesn't make much sense. The layout must take a given container
> size and lay out/resize the contained components to fit. This is the
> pack() operation. Whether the container is being drawn initially or
> after a resize makes no difference at all.

Doesn't the pack() operation go "inside-out". In other words, the
contained components suggest to the container what size it should be?