Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Why isn't this working?

 
Gregg Bolinger
Ranch Hand
Posts: 15304
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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).]
 
Gregg Bolinger
Ranch Hand
Posts: 15304
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Still wondering??? Anyone know?

------------------
Happy Coding,
Gregg Bolinger
 
Nathan Pruett
Bartender
Posts: 4121
IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Gregg Bolinger
Ranch Hand
Posts: 15304
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks a mil Nathan!!

------------------
Happy Coding,
Gregg Bolinger
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic