Solved

maximize JFrame

Posted on 2001-07-16
4
1,100 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 200 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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
web services creation SOAP vs REST 5 80
Selenium docs api java index 3 64
passing enum to a method 4 34
JDBC performance 8 28
Introduction This article is the second of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers the basic installation and configuration of the test automation tools used by…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:
This video teaches viewers about errors in exception handling.

740 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