Any Java Swing programmers out here?

Off topic chat and stuff that doesn't fit elsewhere.
Post Reply
User avatar
His Royal Majesty King V
Veteran K6'er
Posts: 444
Joined: Tue Jul 17, 2001 4:06 pm
Location: New Jersey

Any Java Swing programmers out here?

Post by His Royal Majesty King V » Sat Oct 09, 2004 8:42 pm

All,

I'm trying to figure out how to do something. I've programmed Java, but haven't used Swing much before.

So I have a setup where I have a Frame as follows:

Code: Select all

--------------------
| Panel1           |
|------------------|
| Panel2           |
|                  |
|------------------|
| Panel3           |
|                  |
--------------------
Panel1 is a BoxLayout, horizontal, and works as I want it to.

Panel2 and Panel3 are GridBagLayout, and also more or less work as I expect, except for one thing.

They both take up a large amount of space. More than you'd need for the few items in there.

Is there a way to define whether a panel with a GridBagLayout will use the minimum space allowed or take up all the excess space?

Ideally, I need Panel2 to be only as big as necessary to show the info it's got, and Panel3 to take up all the extra space, as it will be dynamically filled, and I don't want Panel2 to be resizing itself based on how full or empty Panel3 is.

Given that Panel2 and Panel3 are going to have irregular-sized tables, I need them both to be GridBagLayout. (3 colums each of different size, although my sample code doesn't have it that way for now).

If it's easier, you can view the source code, which is 75 lines. I tried to make it as human readable and easy to follow as possible.


Thanks.
FIC PA-2103 E-O036, K6-2+ 450 2.0V @ 500 1.9V
FIC PA-2013 E-O036, K6-III 450 2.2V @ 500
Acer quasi-proprietary Mid-tower, P-II 266

cake
Bios Fryer
Posts: 217
Joined: Sun Jul 01, 2001 3:12 pm
Location: Stockholm, Sweden
Contact:

Post by cake » Sun Oct 10, 2004 12:12 pm

Been too long a time since I did any Swing coding so I can't give you
any tips atm, need to do a refresher first ;)

I can recommend the following short-course which I found very
useful at the time http://java.sun.com/developer/onlineTra ... ourse.html
XP-M 2400+ @ 10x220, Epox 8RDA3+
512 MB PC3200 KingMax
15 GB Quantum Fireball LCT + 60 GB Seagate Barracuda IV
Radeon 8500LE

Post Reply