Article View: borland.public.jbuilder.java.swing
Article #460Re: what is wrong with XY layout
From: Lori M Olson [TeamB]
Date: Thu, 26 May 2005 16:12
Date: Thu, 26 May 2005 16:12
97 lines
5075 bytes
5075 bytes
Tony wrote:
> Hi,
>
> I wonder if anybody would care to share your view on the XY layout and how
> appropriate
> it is to use it in business GUI applications. From time to time I notice
> people say that it is
> not appropriate to use it. For some time I have successfully employed the
> following approach
> for our GUI applications and found it both fast, simple, _predictable_ and
> aesthetically pleasing:
>
> - Main window has a fixed size for which the business application is
> designed (normally based on
> the lowest supported resolution)
> - Forms that are visualized on the main window and forms that appear in
> dialogs all use XYLayout
> with alignment, sizing and positioning done in JBuilder designer.
>
> I have found that Layout managers do very little to help application
> programmers when it comes
> to forms layout. As a rule there IS always a minimum resolution with
> anything lower than minimum
> not making sense and no layout manager in the world can fix that. For
> resolutions higher than what
> the application was desined for in the best case you end up with huge empty
> spaces which normally
> look ugly and can get in the way of functional design.
>
> I am not trying to say that one can not design good UI with the proper usage
> of Layout managers,
> my point is that it takes a lot of effort to do that and the end result in
> my opinion is not worth it.
>
> Tony.
>
>
>
One thing you need to consider is the target audience for your
application. You need to come up with REQUIREMENTS that match your
target audience. And you can hope that this will let you limit one or
more of the display variables, so that you don't have to make sure that
your application looks as good at 1600x1200 as it does at 800x600, and
that every window and dialog is completely flexible and resizeable.
Nailing down those requirements up front will save you a lot of grief at
design time.
Long before Java existed, I worked on cross-platform GUI development
tools in C... and I can tell you that layout problems pre-date Java by
quite a bit.
Layout for applications that need to work on screens of varying
resolution, with user-customizable font sizes, is a *nightmare*.
Layout Managers in Java attempt to help you solve problems in layout.
And they don't all help you solve the same problem. You should know
exactly what problem each layout manager is designed to solve. You
should break your complex dialogs down into separate panels, and let
each panel use the layout manager which is most appropriate.
Something like XYLayout solves the problem of "need to throw something
together quickly that looks good". I'd use it for prototyping, but not
a lot else. As soon as you change any of the display variables,
resolution, font size, aspect ratio, XYLayout will break. That's why
most of us keep harping about not using it.
The hands-down winner for flexibility in layout managers is
GridBagLayout. But you have to sit down with it and learn it properly.
All that flexibility means that it's very difficult to start, but once
you "become one" with it, you will find it possible to layout anything
very quickly. And GridBag is one of the layout managers that solves the
"needs to be resizable" problem very effectively.
I think it is worth the effort to learn the proper usages of all the
layout managers, and then to use them appropriately. If you don't do
that learning, then using layout managers will always be a frustrating
experience.
--
Regards,
Lori Olson [TeamB]
------------
Save yourself, and everyone else, some time and search the
newsgroups and the FAQ-O-Matic before posting your next
question.
Google Advanced Newsgroup Search
http://www.google.ca/advanced_group_search
Other Newsgroup Searches:
http://www.borland.com/newsgroups/ngsearch.html
Joi Ellis's FAQ-O-Matic:
http://www.visi.com/~gyles19/fom-serve/cache/1.html
Technical Details
Message-ID:
<4295f588$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!news.glorb.com!mpls-transit-01.news.qwest.net!38.119.100.82.MISMATCH!news-out.newsgroups.com!propagator2-sterling.newsfeeds.com!in.nntp.be!caladan.landsraad.net!newsgroups.borland.com!not-for-mailReferences:
<4295eeba$1@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Thread: 111d45,5c3cecf063c90622 X-Google-Attributes: gid111d45,public X-Google-Language: ENGLISH,ASCII-7-bit Date: Thu, 26 May 2005 10:12:57 -0600 From: "Lori M Olson [TeamB]" <javadragon@techie.com> User-Agent: Mozilla Thunderbird 1.0.2 (Macintosh/20050317) X-Accept-Language: en-us, en MIME-Version: 1.0 Newsgroups: borland.public.jbuilder.java.swing Subject: Re: what is wrong with XY layout References: <4295eeba$1@newsgroups.borland.com> In-Reply-To: <4295eeba$1@newsgroups.borland.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit NNTP-Posting-Host: 142.179.181.200 Message-ID: <4295f588$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1117123976 142.179.181.200 (26 May 2005 09:12:56 -0700) Lines: 97 Path: arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!news.glorb.com!mpls-transit-01.news.qwest.net!38.119.100.82.MISMATCH!news-out.newsgroups.com!propagator2-sterling.newsfeeds.com!in.nntp.be!caladan.landsraad.net!newsgroups.borland.com!not-for-mail