Notice when a fralme is resized

C

Click

Hello,

I would like to detect when my JFrame is resized. With WindowListerner I
know when it is maximised or inconified, but I cant find how to be noticed
of a simple resize.
Can you help me?

Francois
 
D

Daniel Dyer

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.
 
A

Andrew Thompson

Click said:
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.

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

Message posted via JavaKB.com
http://www.javakb.com/Uwe/Forums.aspx/java-general/200706/1
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,774
Messages
2,569,596
Members
45,128
Latest member
ElwoodPhil
Top