permaculture playing cards*
The moose likes Swing / AWT / SWT and the fly likes Why isn't this working? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Why isn Watch "Why isn New topic
Author

Why isn't this working?

Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15299
    
    6

I am using JDK1.4 and trying to maximize my JFrame. In JDK1.3 I used to setBounds(0, 0, screen.height, screen.width) but that didn't dock the window, just made it as big as the screen. You could still mazimize the JFrame to dock the window. With JDK1.4 you are suposed to be able to setExtendedState(JFrame.MAXIMIZE_BOTH). Below is my code and it is not working. I don't get a maximized frame.

------------------
Happy Coding,
Gregg Bolinger
[This message has been edited by Gregg Bolinger (edited October 17, 2001).]


GenRocket - Experts at Building Test Data
Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15299
    
    6

Still wondering??? Anyone know?

------------------
Happy Coding,
Gregg Bolinger
Nathan Pruett
Bartender

Joined: Oct 18, 2000
Posts: 4121

I had problems with this one too... messed around with it for a long time and thought that it was broken... turns out that you have to call frame.setExtendedState( Frame.MAXIMIZED_BOTH ) after the frame has been initially set visible... not that intuitive if you want a frame to open maximized... but at least now there's a way to do it... BTW, you can use the isFrameStateSupported(int) method of Toolkit to see if a certain frame state is supported in a certain platform.

Here's a working version of your program...



-Nate


-Nate
Write once, run anywhere, because there's nowhere to hide! - /. A.C.
Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15299
    
    6

Thanks a mil Nathan!!

------------------
Happy Coding,
Gregg Bolinger
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: Why isn't this working?
 
Similar Threads
Awt vs. Swing error
Internal Frames Problems...need help
Setting Title from Jpanel to Jframe
JInternalFrames + JSliders
Adding Buttons in JDesktoPane