aspose file tools*
The moose likes Swing / AWT / SWT and the fly likes Maximizing a Frame Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Maximizing a Frame" Watch "Maximizing a Frame" New topic
Author

Maximizing a Frame

Drew Lane
Ranch Hand

Joined: May 13, 2001
Posts: 296
I'd like to create the effect that occurs when you click on the "Maximize" Button on Windows OS. (ie. the middle button in the top right corner)
I can use Toolkit.getDefaultToolkit().getScreenSize();
and then resize the Window, but it's not the same.
I've tried generating the event with the processEvent and dispatchEvent methods, but I can only get it to work for a WINDOW_CLOSING event.
I noticed that when I click on the Maximize button, it generates a WINDOW_DEACTIVATED event in Java. But if I try to send this event, it does nothing?
How else can I do this?
Thanks,
Drew
Nathan Pruett
Bartender

Joined: Oct 18, 2000
Posts: 4121

JDK 1.4 added the setExtendedState( int ) method to the Frame class. The int value to send to it is Frame.MAXIMIZED_BOTH to maximize the Frame.


-Nate
Write once, run anywhere, because there's nowhere to hide! - /. A.C.
Drew Lane
Ranch Hand

Joined: May 13, 2001
Posts: 296
Thanks, but I'm stuck using JDK 1.1 for this.
Drew
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Maximizing a Frame