🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.jbuilder.java.swing
Article #7511

Problems with building a GUI in SWING- help appreciated

#7511
From: Mikael Eriksson
Date: Mon, 15 Jan 2001 20:39
53 lines
3638 bytes
Hi folks,

I'm getting reacquinted with JAVA and learning to know the Swing-set. I'm
trying to build a GUI looking like the following (hopefully my ASCII-art
talents are up to date):

----------------------------------------------
| CCCCC                                      |
|                                            |
|------------------------                    |
| IIIII                 | TTTTT              |
|                       |                    |
|                       | BBBBB              |
|                       |                    |
|                       |                    |
|-----------------------|                    |
|                                            |
|                                            |
----------------------------------------------

CCCCC is a JComboBox, IIIII is an image, TTTTT and BBBBB are JTextField:s.
The idea is easy, by selecting something from CCCCC the contents of IIIII,
TTTTT and BBBBB will get updated. That's actually no problem, but the design
and layout of the controls are giving me gray hairs. All of these controls
are layedout on a JPanel that sits on a JTabbedPanel. I've done numerous
variants of sub-Jpanel:s, Box:es, BoxLayout:s, ad infinitum but at least the
following problems always remain:

* I want the panel containing the image to remain of a static size, 200x200
pixels. Unfortunately the size of the panel varies with the image I put on
it, causing silly behavior when I update CCCCC.

* I also want the length of the JTextFields TTTTT and BBBBB to be fixed,
independently of their content (which also can be empty).

* The combined height of TTTTT and BBBBB equals the height of the panel
containing IIIII. I've tried to add some VerticalGlue, combined with a
VerticalBox (as well as various other combinations). Nothing helps.

* I can't get the image to center vertically on the panel, only horizontally
by using a FlowLayout.

I can't for my life figure out the proper combination of different layouts,
containers, panels and other widgets. If somebody could help me with the
setup I would be deeply grateful. I don't need any code, that I can do
myself. Something along the line: "Do a BorderLayout BL1 on the main Panel,
put a JPanel JP1 to the NORTH of BL1. Set layout of JP1 to FlowLayout.LEFT
and add a JComboBox to JP1." And so on!

I know, it's a lot, but I would appreciate the help, too! Many thanks in
advance.

Misha
Technical Details
Message-ID: <93vn68$1ec$1@tron.sci.fi>
Path: arc1-ca.pugleaf.net!supernews.google.com!sn-xit-03!sn-xit-04!supernews.com!216.227.56.88.MISMATCH!telocity-west!TELOCITY!enews.sgi.com!newsfeed1.funet.fi!newsfeeds.funet.fi!130.230.10.15.MISMATCH!news.cc.tut.fi!uutiset.saunalahti.fi!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 111d45,1d730f8c3387b206
X-Google-Attributes: gid111d45,public
X-Google-Thread: 10fd6d,1d730f8c3387b206
X-Google-Attributes: gid10fd6d,public
X-Google-ArrivalTime: 2001-01-15 12:40:07 PST
Path: arc1-ca.pugleaf.net!supernews.google.com!sn-xit-03!sn-xit-04!supernews.com!216.227.56.88.MISMATCH!telocity-west!TELOCITY!enews.sgi.com!newsfeed1.funet.fi!newsfeeds.funet.fi!130.230.10.15.MISMATCH!news.cc.tut.fi!uutiset.saunalahti.fi!not-for-mail
From: "Mikael Eriksson" <Mikael.Eriksson@edu.hel.fi>
Newsgroups: borland.public.jbuilder.java.swing,comp.lang.java.gui
Subject: Problems with building a GUI in SWING- help appreciated
Date: Mon, 15 Jan 2001 22:39:03 +0200
Organization: SAUNALAHDEN asiakas
Lines: 55
Message-ID: <93vn68$1ec$1@tron.sci.fi>
NNTP-Posting-Host: cs87214.pp.htv.fi
X-Trace: tron.sci.fi 979591176 1484 212.90.87.214 (15 Jan 2001 20:39:36 GMT)
X-Complaints-To: newsmaster@saunalahti.fi
NNTP-Posting-Date: 15 Jan 2001 20:39:36 GMT
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 5.50.4522.1200
X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4522.1200