PDA

Click to See Complete Forum and Search --> : Resize event?


crptcblade
Jul 7th, 2002, 11:27 AM
Is there a listener that can detect when a Frame/JFrame is resized?

I know that WindowListener can tell when a frame is minimized/restored, but I would like to know when say the dimensions of the frame go from 100,100 to 150,150. I tried overriding the setSize and setBounds methods to detect it, but that only works for explicit calls to the method, not if the user resizes the frame manually.

Anyone have any ideas?

:)

Dillinger4
Jul 10th, 2002, 12:17 AM
I guess i will give this a shot crptc. You could either add a ComponentListener to the JFrame or you could just add a Component adapter. I would probably go with the adapter since you are just interested in listening for one event.

Event Listener Methods:

componentHidden(ComponentEvent evt)
componentMoved(ComponentEvent evt)
componentResized(ComponentEvent evt)
componentShown(ComponentEvent evt)