kaharas
kaharas

Reputation: 607

GUI with fluid resizing behaviour

is it possible using swing, to build a GUI whose elements, when the GUI is resized, keep te proportion between themself? Or i should fire a "resize every GUI component" function when the resize event occurs? I'm using Netbeans 6.9

Upvotes: 3

Views: 1815

Answers (2)

Russ Hayward
Russ Hayward

Reputation: 5667

I think that using traditional layout techniques is the best way to go - you generally want to choose which components resize and how they do it. However, if you really want a proportional resize then have a look at this answer:

java swing resize

Upvotes: 1

Riduidel
Riduidel

Reputation: 22292

Long ago, there was a very interesting article series on JavaWorld about "transmogrifying widgets" by Allen Hollub. This serie explain how, using different widgets to sho the same information, a calcoulator can have different styles when viewed with different dimensions.

However, for a far simpler (but far less powerful) approach, you should take an in-depth look to GridBagLayout and the (now famous) GBC class. This will give you a fast, and quite elegant, method to resize your whole UI with interesting resizing behaviours (oh and don't forget the associated tutorial).

Upvotes: 3

Related Questions