...
>I would like to detect when my JFrame is resized.

Signature
Andrew Thompson
http://www.athompson.info/andrew/
>>I would like to detect when my JFrame is resized.
> Why?
It is for a game. I need to center the display of the game in the window.
Daniel Dyer - 13 Jun 2007 10:42 GMT
>>> I would like to detect when my JFrame is resized.
>> Why?
>
> It is for a game. I need to center the display of the game in the window.
java.awt.event.ComponentListener
Other related events can be handled, if necessary, with WindowListener.
Dan.

Signature
Daniel Dyer
http://www.uncommons.org
Andrew Thompson - 13 Jun 2007 10:46 GMT
>>>I would like to detect when my JFrame is resized.
>> Why?
>
>It is for a game. I need to center the display of the game in the window.
What happens to the rest of the space?
- If it is merely 'wasted space', I would suggest instead
to put the game in BorderLayout.CENTER, and lock the
size of the JFrame.
- If the game itself is resizable and a custom component,
again put it in BorderLayout.CENTER, but cache the size,
then check it each paint().
- If the game is resizable and made of standard components
or layouts, it should resize automatically.

Signature
Andrew Thompson
http://www.athompson.info/andrew/