views:

22

answers:

1

I know I can user componentResized to listen for when the user resizes a window. This isn't a very nice solution. If I do this and add a resize() method for the children components, it waits until the user finishes the resizing until it calls the resize() method. Is there a way to resize the child elements as the resize happens?

+1  A: 

The listener with componentResized() is the nice solution. Using listener in swing isn't a bad solution at all.

You can see the solution you want on oracle.com

Colin Hebert
My problem is, if the user resizes the window from 600px to 800px, the components inside will not resize until the user has finished resizing. It looks damn terrible. I am seeking something that will resize the components with the window.
Glenn Nelson
usually component are resizing at the same time as the container (see the example given in the answer).
Colin Hebert
I was adding the listener to my window and not my JPanel, that was my problem.
Glenn Nelson