[jaxx-interest] new blog entry: "Reinventing GridBagLayout"
Ethan Nicholas
ethan at ethannicholas.com
Sat Apr 22 10:15:21 EDT 2006
Excellent question. Enhanced support for more layouts is one of the
things I have planned for the next release after 1.0. I will almost
certainly add support for FormLayout, probably GroupLayout, and possibly
SpringLayout -- although frankly I'm not sure how many people actually
use SpringLayout.
Where do you guys think the priorities lie? Which layouts are most
important? How would you structure the XML for them?
Ethan
Ruben Reusser wrote:
> Forgive my ignorance, but what about spring layout support in JAXX?
> That actually might give us a lot of flexibility:
>
> <Application>
> <Spring id="spring">
> <JLabel id="l1">
> <JTextField id="t1">
> <JLabel id="l2">
> <JTextField id="t2">
> <JButton id="b1">
> <JButton id="b2">
>
> <attach source="l1" sourceSide="west" dest="spring"
> destSide="west" distance="5">
> ...
>
> </spring>
> </Application>
>
>
> Ethan Nicholas wrote:
>> In that case it sounds like it's just nested boxes -- which is
>> certainly something JAXX can do (using <VBox> and <HBox>), but Table
>> is quite different. The point of Table is to constrain rows and
>> columns relative to each other, for instance to make sure that both
>> JTextFields start at the same coordinate by putting them into the
>> same column.
>>
>> Ethan
>>
>>
>> Anderson, Kelly wrote:
>>
>>> If you are self-constrained not to create a new layout mechanism, then
>>> this conversation MAY be somewhat pointless.
>>>
>>> This boxes and glue constraint system is based on the idea that every
>>> control has a minimum, maximum and desired size in both x and y.
>>>
>>> So, If the minimum size of Label 1 were larger than the minimum size of
>>> Label 2, then you would get something like this:
>>>
>>> +------------------------------------------+
>>> |+----------------------------------------+|
>>> ||+-----------------------++-------------+||
>>> ||| Label 1 || Text 1 |||
>>> ||+-----------------------++-------------+||
>>> |+----------------------------------------+|
>>> |+----------------------------------------+|
>>> ||+-------------++-----------------------+||
>>> ||| Label 2 || Text 2 |||
>>> ||+-------------++-----------------------+||
>>> |+----------------------------------------+|
>>> | +--------------------+ |
>>> | |+--------++--------+| |
>>> | || OK || Cancel || |
>>> | |+--------++--------+| |
>>> | +--------------------+ |
>>> +------------------------------------------+
>>>
>>> The rules are:
>>> The minimum horizontal size of a horizontal box is the sum of
>>> the minimum sizes of it's children (recursively).
>>> The maximum horizontal size of a horizontal box is the sum of
>>> the maximum sizes of it's children (recursively).
>>> If a horizontal box is inside of a vertical box and the space
>>> available is between the minimum and maximum size, then it will layout
>>> to the size of the vertical containing box. If a horizontal box
>>> is inside of a vertical box and the maximum
>>> size is less than the current horizontal size of the vertical box, then
>>> it uses the justification of the containing box to decide how to
>>> layout.
>>>
>>> For example, if the top level vertical box is left justified, then the
>>> dialog would layout like this:
>>>
>>> +------------------------------------------+
>>> |+----------------------------------------+|
>>> ||+-----------------------++-------------+||
>>> ||| Label 1 || Text 1 |||
>>> ||+-----------------------++-------------+||
>>> |+----------------------------------------+|
>>> |+----------------------------------------+|
>>> ||+-------------++-----------------------+||
>>> ||| Label 2 || Text 2 |||
>>> ||+-------------++-----------------------+||
>>> |+----------------------------------------+|
>>> |+--------------------+ |
>>> ||+--------++--------+| |
>>> ||| OK || Cancel || |
>>> ||+--------++--------+| |
>>> |+--------------------+ |
>>> +------------------------------------------+
>>>
>>> Again, it's harder to describe in email than to show... :-)
>>>
>>> -Kelly
>>>
>>>> -----Original Message-----
>>>> From: Ethan Nicholas [mailto:ethan at ethannicholas.com] Sent:
>>>> Thursday, April 20, 2006 4:18 PM
>>>> To: Anderson, Kelly
>>>> Cc: jaxx-interest at jaxxframework.org
>>>> Subject: Re: [jaxx-interest] new blog entry: "Reinventing
>>>> GridBagLayout"
>>>>
>>>> Ok, making a bit more sense now. First things first -- Table is
>>>> very much designed around GridBagLayout, and I'm not (yet, at
>>>> least) going to develop a completely new layout manager, so I'm
>>>> fairly constrained here.
>>>>
>>>> That said, I do want to understand your suggestion. Suppose we
>>>> draw the table with labels much narrower than the text fields, as
>>>> it would be in a typical view:
>>>>
>>>> +--------+---------------------------------+
>>>> |Label 1:|Text field |
>>>> +--------+---------------------------------+
>>>> |Label 2:|Text field |
>>>> +--------+---------------------------------+
>>>> | +------+ +------+ |
>>>> | | OK | |Cancel| |
>>>> | +------+ +------+ |
>>>> +------------------------------------------+
>>>>
>>>> That's the logical structure of my example, and it's important that
>>>> the vertical divide between the OK and Cancel buttons not need to
>>>> match up with the vertical divide between the labels and text
>>>> fields. That's why the third row uses a subpanel, to avoid that
>>>> problem.
>>>>
>>>> In your example all three rows are set up exactly the same, which
>>>> has me assuming that either A) the vertical divides will line up
>>>> between all three rows, or B) the vertical divides will not line up
>>>> in any of the rows. Either way, it doesn't match what I'm doing
>>>> with my example, unless I'm badly misreading something (which is
>>>> entirely possible).
>>>>
>>>> Ethan
>>>>
>>>>
>>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>> E-Mail messages may contain viruses, worms, or other malicious code.
>>> By reading the message and opening any attachments, the recipient
>>> accepts full responsibility for taking protective action against
>>> such code. Sender is not liable for any loss or damage arising from
>>> this message.
>>>
>>> The information in this e-mail is confidential and may be legally
>>> privileged. It is intended solely for the addressee(s). Access to
>>> this e-mail by anyone else is unauthorized.
>>>
>>>
>>> _______________________________________________
>>> jaxx-interest mailing list
>>> jaxx-interest at jaxxframework.org
>>> http://jaxxframework.org/mailman/listinfo/jaxx-interest_jaxxframework.org
>>>
>>>
>>>
>>
>>
>> _______________________________________________
>> jaxx-interest mailing list
>> jaxx-interest at jaxxframework.org
>> http://jaxxframework.org/mailman/listinfo/jaxx-interest_jaxxframework.org
>>
>>
>
>
More information about the jaxx-interest
mailing list