Article View: borland.public.jbuilder.java.language
Article #295Re: Using the Design mode - Adding controls to a form.
From: Paul Furbacher [TeamB]
Date: Thu, 25 Jan 2007 05:29
Date: Thu, 25 Jan 2007 05:29
96 lines
4829 bytes
4829 bytes
Rob wrote:
> OK what I have learnt so far ;
>
> 1/You need to stick a jPanel Swing container. on your form and change
> the layout manager to one of the options in the form properties.
>
> http://java.sun.com/docs/books/tutorial/uiswing/
>
> All the layout managers that I have are good for making 1 x 1 inch
> forms. None of them are useful for making anything but the most basic
> of interfaces.
Without any code examples from your efforts, it's hard
to tell what you might be doing wrong, but if you are using
JBuilder, you are looking at a Swing app which is only
useful if you have sized it to much more than 1"x1". In other
words, all the layouts provide for forms, panels, you name it,
of varying size. That's the whole point of Swing layouts.
They can grow and shrink, and still maintain a sense of proportion.
> The XY layout gives me what I want but does not compile.
It temporarily may give you what you want, but in a cross-platform
world of many resolutions, you really don't want it. Have you
ever just played with Windows, playing with the large fonts/small
fonts settings? What happened to text in various locations on
some of your or other apps' forms? Right, it got cut off.
Same applies to taking your pretty XYLayout on Windows and running
it on a Linux or OS X box.
> So I would like to ask the following questions
>
> 1/ The XY layout exists for a reason. Do I use the coordinates in code
> to produce the form I want.
No, as the JBuilder Help on laying out a form suggests, you
can initially layout the form using XYLayout, but switch to
some other layout before running. The most appropriate/useful
layout, and also the hardest to learn, is the GridBagLayout.
If you stick with Java, and anticipate doing a lot of Swing
UI work, you owe it to your career to learn the GridBagLayout
well.
(Flashback to 1998, I'm writing the same advice in 2007!)
When I do Swing UI work, which isn't often, I use
the GBL in maybe 99.99% of all layouts. As soon as I
create a new frame, or new panel, I flip the layout to
GBL; I never use the XYLayout.
An alternative, one which JBuilder does not support in its
UI Designer, is the SpringLayout (thank you NeXT Interface
Builder, now Apple Interface Builder).
An altogether different layout manager is used by the Matisse
UI Designer which is a part of the most recent releases of
NetBeans. Matisse is probably the best Swing UI designer
available.
> 2/Is there a way to combine the layouts into one forms.
Yes, a form is typically composed of a number of panels.
Each panel can use a different layout manager depending on
how the controls in the panel are laid out.
> All this to create a simple data entry form. I am starting to think
> that Java is not the right tool to do what I want.
It may not be. Do you have any need for being able to
run on other operating systems, or just Windows? Do you
need other APIs which are standard in Java and not so
readily available in other programming toolkits? Do you
need any of the far more numerous open source projects
that the Java world provides than say the .NET world?
Those are the questions which should be asked in the
evaluation of whether you should be using Java, .NET,
Win32, or Cocoa (Mac OS X), or ...?
--
Paul Furbacher (TeamB)
Save time, search the archives:
http://info.borland.com/newsgroups/ngsearch.html
Is it in Joi Ellis's Faq-O-Matic?
http://www.visi.com/~gyles19/fom-serve/cache/1.html
Finally, please send responses to the newsgroup only.
That means, do not send email directly to me.
Thank you.
Technical Details
Message-ID:
<45b83fdf$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news2.google.com!news3.google.com!news.glorb.com!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mailReferences:
<ygAsh.3944$u8.3431@news-server.bigpond.net.au> <45b363aa$1@newsgroups.borland.com> <gB2th.4660$u8.4227@news-server.bigpond.net.au> <45b4d889$1@newsgroups.borland.com> <qwHth.5730$u8.343@news-server.bigpond.net.au>Show Full Headers
Complete Article Headers
X-Google-Thread: f74b3,a4534d4eccde8c1 X-Google-Attributes: gidf74b3,public X-Google-Language: ENGLISH,ASCII-7-bit Date: Thu, 25 Jan 2007 00:29:27 -0500 From: "Paul Furbacher [TeamB]" <pfurbacher@mac.com> Organization: Reverse Alchemy, Inc. User-Agent: Thunderbird 1.5.0.9 (Macintosh/20061207) MIME-Version: 1.0 Newsgroups: borland.public.jbuilder.java.language Subject: Re: Using the Design mode - Adding controls to a form. References: <ygAsh.3944$u8.3431@news-server.bigpond.net.au> <45b363aa$1@newsgroups.borland.com> <gB2th.4660$u8.4227@news-server.bigpond.net.au> <45b4d889$1@newsgroups.borland.com> <qwHth.5730$u8.343@news-server.bigpond.net.au> In-Reply-To: <qwHth.5730$u8.343@news-server.bigpond.net.au> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit NNTP-Posting-Host: 69.142.194.228 Message-ID: <45b83fdf$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1169702879 69.142.194.228 (24 Jan 2007 21:27:59 -0800) Lines: 96 Path: arc1-ca.pugleaf.net!g2news2.google.com!news3.google.com!news.glorb.com!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail