?
Solved

maximize JFrame

Posted on 2001-07-16
4
Medium Priority
?
1,104 Views
Last Modified: 2008-02-01
how can i maximize a JFrame?
frame.setState does not offer maximize...

thnx
0
Comment
Question by:Hoffa
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 Comments
 
LVL 3

Accepted Solution

by:
Dmitriy earned 600 total points
ID: 6287299
unfortunately, as far as I know, there is no way to explicitly state the state of frame to MAXIMIZED.  If you want to maximize the frame on load, you can do so in a batch file:


start /max java ClassName.class

The /max will make the window maximized
0
 
LVL 19

Expert Comment

by:Jim Cakalic
ID: 6287326
There is currently no direct support for this. The best you can do is make sure the frame is deiconified then set its size to the screen size.

frame.setState(Frame.NORMAL);
Toolkit toolkit = Toolkit.getDefaultToolkit();
Dimension dimension = toolkit.getScreenSize();
frame.setSize(dimension);

Of course, the os will not treat this as a maximized frame, so in general this is a poor substitute for simulating maximize. Furthermore, on Windows this technique does not respect the toolbar. There are non-portable methods using JNI which I have used to do the same on Win32.

On the bright side, JDK 1.4 looks like it will provide direct support for this capability -- finally.

Best regards,
Jim Cakalic
0
 
LVL 16

Expert Comment

by:Valeri
ID: 6288893
L
0
 

Expert Comment

by:c2000
ID: 6289407

frame.setSize(Toolkit.getDefaultToolkit().getScreenSize());
is the simple way to mixize a JFrame. But if you want to maximize a JFrame instead of resizing it. You can use the new functions in the following link:
http://java.sun.com/j2se/1.4/docs/guide/awt/AWTChanges.html#fullscreen
0

Featured Post

New benefit for Premium Members - Upgrade now!

Ready to get started with anonymous questions today? It's easy! Learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

An old method to applying the Singleton pattern in your Java code is to check if a static instance, defined in the same class that needs to be instantiated once and only once, is null and then create a new instance; otherwise, the pre-existing insta…
By the end of 1980s, object oriented programming using languages like C++, Simula69 and ObjectPascal gained momentum. It looked like programmers finally found the perfect language. C++ successfully combined the object oriented principles of Simula w…
Viewers learn about the third conditional statement “else if” and use it in an example program. Then additional information about conditional statements is provided, covering the topic thoroughly. Viewers learn about the third conditional statement …
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
Suggested Courses
Course of the Month8 days, 5 hours left to enroll

765 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question