• Post Reply Bookmark Topic Watch Topic
  • New Topic

Swing method to size component  RSS feed

 
Ansh Bhai
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,
Is there any method for swing components say, JFrame to set it to its maximum size of the screen/monitor window when I want it to show/display. I know you have, setSize, setMaximumSize, etc. all but they all take parameters (Dimension).
Thanks in advance!
 
Peter Phung
Ranch Hand
Posts: 138
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm not sure if there is a method to just maximise frames, but you can use something like
Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
yourComponent.setSize(screenSize.width,screenSize.height);
HTH
 
Manfred Leonhardt
Ranch Hand
Posts: 1492
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Ansh,
If you are using JDK1.4 you can use the following:
myFrame.setExtendedState( Frame.MAXIMIZED_BOTH );
Regards,
Manfred.
 
Ansh Bhai
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, I am using JDK1.4
Thanks a lot guys!
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!