>> >If its only a prototype, what about using a GUI builder?
>>
[quoted text clipped - 8 lines]
>
> Please explain.
Well, this GUI was quite complex therefor Gridbag LM would be the solution,
but as maybe you know
Gridbag LM isn't only one of the most powerfull LM but also one of most
complex LM and you will need much more time as if you use GUI builder with
null Layout.
Andrew Thompson - 23 Nov 2007 11:33 GMT
>>> >If its only a prototype, what about using a GUI builder?
>>>
[quoted text clipped - 7 lines]
>complex LM and you will need much more time as if you use GUI builder with
>null Layout.
But you spend much more time trying to figure how
to attach ComponentListener(s) or monitoring a 'DPI
change' rather than simply allowing a LayoutManager
(or LayoutManager*s* in the case of a nested layout)
to figure how to distribute the available space amongst
the components.
I did an experiment since this thread started, changing
my 96 DPI Widows computer to 120 DPI. Every one of
my GUIs (using standard J2SE Layouts) looks entirely
logical to the new DPI, without any need of 'knowing'
either the screen size, or DPI. Note that this 'logical'
look is more a testament to the clever people that designed
the layouts, than anything to do with me - I just invoked
their (well designed) logic in my GUIs.

Signature
Andrew Thompson
http://www.physci.org/
Andrew Thompson - 23 Nov 2007 11:39 GMT
>>>> >If its only a prototype, what about using a GUI builder?
Can you give us an idea of what this GUI is supposed
to look like*? I (almost) guarantee it is possible to code
it using standard J2SE Layouts.
*One tricky aspect is that it is important for us to understand
how 'space' in the GUI will be 'redistributed' when the GUI
is resized. For example, what componets get 'the rest of
the space' when there is extra space to give to the GUI?

Signature
Andrew Thompson
http://www.physci.org/
Abdelali Adil - 23 Nov 2007 16:23 GMT
> Andrew Thompson wrote:
>>>>> >If its only a prototype, what about using a GUI builder?
>
> Can you give us an idea of what this GUI is supposed
> to look like*? I (almost) guarantee it is possible to code
> it using standard J2SE Layouts.
You are right , you can do the almost of things by combining many LMs, But
in my case it was only a matter of time.
RedGrittyBrick - 23 Nov 2007 14:58 GMT
>>> I used a GUI builder and i used null LM.
>>
[quoted text clipped - 13 lines]
> complex LM and you will need much more time as if you use GUI builder
> with null Layout.
I agree GridBagLayout is complex (and quirky). That is why I often use
* Nested layouts (e.g. BoxLayout inside BoxLayout)
* MigLayout. More powerful than GridBagLayout, easier, free and concise.
A simple example from http://www.miglayout.com/QuickStart.pdf
+-----+-------------+-----+
|comp1| |comp3|
+-----+ comp2 +-----+
|comp4| |comp5|
+-----+--------+----+-----+
|comp6| comp7 | | |
+-----+--------+----+-----+
panel = new JPanel(new MigLayout());
panel.add(comp1);
panel.add(comp2, "span 2 2");
panel.add(comp3, "wrap");
panel.add(comp4);
panel.add(comp5);
panel.add(comp6);
panel.add(comp7);
I doubt I could do that as easily using a null layout. YMMV
Sizes can be specified in units that take DPI into account (points ,cm,
inches etc) It also has "logical pixels" which caters for varying sizes
of "normal" font on the platform.
You can specify which components grow to grab available space as the
container is resized (weighted, grouped), alignment, insets, equalize
button sizes, etc etc etc. It can mimic flowlayout and borderlayout as
well as grid oriented layouts.
It can also do absolute positioning, or a mix!
I added MigLayout's source to my workspace, so using and deploying is ,
for me, the same as for any standard layout manager.
Note: I'm not associated with Mig in any way other than as a happy user
of MigLayout.
Karsten Lentzsch - 26 Nov 2007 08:45 GMT
> [...]
> Gridbag LM isn't only one of the most powerfull LM but also one of most
> complex LM and you will need much more time as if you use GUI builder
> with null Layout.
Although GridBagLayout is complex, it is one of
the weaker Java layout managers.
Since this has been mentioned in this thread:
I've found in layout courses that most developers
end up with better design if they use a flat
grid-based layout and avoid nesting.
There are design-cases where nesting makes sense;
as a general guideline it should be avoided in
Swing, because otherwise you loose layout constraints
required for aligning (sub-)elements. Swing LMs
do not provide inter-panel layout constraints.
I've also found in the layout courses that many
developers face problems with building a mental
layout when reading layout code that mixes the
design specification with the panel building.
That's the case for GridBagLayout and how
MIGLayout is advertised. If you have 50 components,
even the last constraint can change the number
of columns.
In contrast TableLayout has invented a style where
the developer can understand the layout specification
by reading a few lines of code. That's the fixed part.
The longer panel building part does not affect
the overall design (columns, often rows).
I provide a free and open layout system that aims
to address the needs of developers as well as the
requirements for useable visual tools, the JGoodies
Forms. It has been designed to make it easier to
find a layout (it's grid based), and to implement
with hand or tool. The JGoodies FormLayout has visual
plugins for Eclipse, Netbeans and is integrated with
IDEA.
Here's more information:
http://www.jgoodies.com/freeware/forms/index.html
-Karsten Lentzsch