I second almost everything Ian Griffiths said, but I'd like to explore a
thought:

> Anchor and dock aren't about completely automatic layout.
> They're about enabling automatic resizing in what is
> otherwise an essentially fixed, manually-built layout.
>
..
>
> And I'd second Ivan's remark that relying entirely on
> automatic layout tends to result in pretty shabby-looking
> user interfaces. Java doesn't exactly have a reputation for
> producing slick-looking UIs, and its approach to layout is
> one of the contributing factors.

It sounds like you're saying Java layout managers are designed to let you
throw controls into them with only minimal thought, and the layout manager
will make it look good.  Clearly, if this is the goal, then Java layout
managers have failed.  But I thought (and I'm far from a Swing expert, only
having used it a few times) what they really expect you to do, for all but
toy apps, is manually design a layout and then wrestle the layout managers
into displaying that layout.  It's a more difficult process but the end
result should be very resilient to changes in screen resolution, localized
strings, and resizing, because the layout manager now has access to the
semantics of the layout, not just what control lines up with what pixel
coordinate.

In other words, rather than being easy to use but not giving you much
control, they are hard to use but give you all sorts of control.  Or really,
since LayoutManager is an interface and several implementations are provided
out of the box, there are a spectrum of possible ease-of-use/control
tradeoffs.

In comparison, the Windows Forms approach gives you ease of use and a medium
amount of control--if you want more control, you have to override OnLayout
and go fully manual.  (I'm not saying this isn't the right approach, judging
by how easy it is to build a good looking .NET app and how infrequently I
run into situations where Anchor/Dock can't meet my needs.)

Am I totally off base?  Perhaps someone with more Swing experience can set
me straight.

Anyway, the only reason I think it's worth discussing is because I think
there's hope to come up with layout managers that are more flexible than
Anchor/Dock and yet less complex and unintuitive than
java.awt.GridBagLayout.

===================================
This list is hosted by DevelopMentor�  http://www.develop.com
Some .NET courses you may be interested in:

Essential .NET: building applications and components with CSharp
August 30 - September 3, in Los Angeles
http://www.develop.com/courses/edotnet

View archives and manage your subscription(s) at http://discuss.develop.com

Reply via email to