Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / June 2007

Tip: Looking for answers? Try searching our database.

Notice when a fralme is resized

Thread view: 
Click - 13 Jun 2007 10:09 GMT
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
Andrew Thompson - 13 Jun 2007 10:29 GMT
...
>I would like to detect when my JFrame is resized.

Why?

Signature

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

Click - 13 Jun 2007 10:33 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.
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/



Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.