Java Solaris Communities Sun Store Join SDN My Profile Why Join?
 
Bug Database
Bug Detail
Quick Lists
Top 25 Bugs
Top 25 RFE's
Recently Closed Bugs
Printable Page Printable Page


Bug Database
Bug ID: 4071554
Votes 192
Synopsis Ability to programmatically maximize a window
Category java:classes_awt
Reported Against 1.2 , 1.1.1 , 1.1.3 , 1.2.1 , 1.2fcs
Release Fixed 1.4(merlin-beta)
State 10-Fix Delivered, request for enhancement
Priority: 4-Low
Related Bugs 4073350 , 4173094 , 4198845
Submit Date 13-AUG-1997
Description




I would like the AWT to include the capability
to maximize a Window programatically.
Such a capability would be great for things like
Java slide shows, Java word processors,
Java developer IDE's, etc.
It sucks that you would have to currently use
something like J/Direct just to maximize
the darn window programatically. At least
we should have the ability to bring up the Window
initally maximized.

======================================================================
Work Around





======================================================================
Evaluation
This makes total sense.


  xxxxx@xxxxx   2000-01-06
Comments
  
  Include a link with my name & email   

Submitted On 24-APR-1998
aw
You can do this to make the Frame the size of the screen:
Dimension screen =
    frame.getToolkit().getScreenSize();
frame.setSize(screen.width, screen.height);
But under Win95/NT, this doesn't take into account the users taskbar and other
appbars.  The problem is getScreenSize() should probably use the Win32 API  
::SystemParametersInfo(SPI_GETWORKAREA,...)
 instead of ::GetSystemMetrics(SM_CXSCREEN)/SM_CYSCREEN


Submitted On 04-JUN-1998
hueller
Yes, it sucks. ;-)
Too bad there's no maximize java.awt.event.WindowEvent!
aw's solution is alright for slideshows, but I'd also
have full control over the maximize button!


Submitted On 23-JUN-1998
ionFreeman
I really don't want to wait for java 1.3 to be able to maximize the frame.
Could you post a JNI workaround?
Thanks.


Submitted On 24-JUL-1998
feinberg
Maximizing a Frame is only part of the problem.
It is also very important to be able to minimize
and restore (unminimze) a Frame programmatically.
The restoration of a minimized Frame is of 
particular interest to me since I have an
application which runs continuously and enforces
the fact that only one instance of it is allowed
on a system at any given time.  If the app is
currently minimized and the user tries to start
another instance, I need to be able to restore
the original instance rather than opening a new
one.  The Frame class (or a superclass) should
simply have maximize(), minimize() and restore()
methods.


Submitted On 10-AUG-1998
Navernyuk
That is realy needed!
Navernyuk@iname.com


Submitted On 28-NOV-1998
kirkh
What's the state of the ability to (un)minimize and
(un)maximize via events programmers can control?
We're really stuck on our project because there is
no public API to programatically unminimize an iconified
JFrame.  Why is this problem taking so long to be
resolved??


Submitted On 24-DEC-1998
carlmoss
Come on guys, how hard can this be ? And this was
raised August 1997 ! And it hasn't even been
evaluated yet even though it's got over 30 votes !


Submitted On 19-FEB-1999
mcbeeb
Please add this feature.  This question comes
up in newsgroups constantly.  It's a basic
function that should be supported.  Is there any
reason why this issue hasn't even received any
comment from Sun???  At least give some kind of
justification for why this feature has been missing for so long -- what's the
reason?


Submitted On 15-APR-1999
chabber
Can we atleast get an evaluation of this?  Something?


Submitted On 22-APR-1999
Zappie
I agree with feinberg.  To write industrial strength business applications, I
need to be able to have the ability to restore a minimized window.  For example,
 a user may be displaying information about several different items, and may
have them minimized.  The next time they choose to see the information for an
item whose window has been minimized, they should see that window, not create a
new one.
This is an absolute necessity.


Submitted On 24-APR-1999
kenmcneil
I have a descent workaround that I employed in a
client side app I created. Basically I stored the
size and posistion of the frame when the program
exited and later restored it. This way if the user
has control. This does not solve all the problems
but it does get around taskbars and the like.


Submitted On 08-JUN-1999
klee4
We definitely need this.  I need to determine when the user has pressed
maximized button or minimized button.


Submitted On 08-JUN-1999
mgarg
We definately need this feature for our product.


Submitted On 10-JUN-1999
memphis_
We need this as soon as possible


Submitted On 11-JUN-1999
SnagaGhash
I need this feature for my application. I can store and restore every other
screen data for an INI file. But if the window is maximized the button state
can not be captured and restored.


Submitted On 06-JUL-1999
kshashank
This feature is MUST as it is required in 
many cases. Also facility to disable minimize or
maximize button individually is appreciated.


Submitted On 06-JUL-1999
kshashank
This feature is MUST as it is required in 
many cases. Also facility to disable minimize or
maximize button individually is appreciated.


Submitted On 09-JUL-1999
RobFisher
I would like to see the window automatically maximized.
Thanks.


Submitted On 05-AUG-1999
_2Mike
I think there is a way to restore and minimize. Use setState.
Minimize:     
MyFrame.setState( Frame.ICONIFIED );
Restore:
MyFrame.setState( Frame.NORMAL );


Submitted On 13-SEP-1999
FreddieSchwenke
Agreed.  I would like to see this feature too.


Submitted On 30-SEP-1999
lazarg
I need this feature! And, as far as I can see, there is nothing done in
"JDK 1.3beta-O" too.


Submitted On 30-SEP-1999
lazarg
I need this feature! And, as far as I can see, there is nothing done in
"JDK 1.3beta-O" too.


Submitted On 19-OCT-1999
TurnerJ
I've noticed that under 1.3 Beta-whatever under Win32 that Window objects that
have a size and position equal to the bounds of the screen are brought to the
front of the z-order, overtop of the taskbar... Kudos to Sun for this.


Submitted On 07-NOV-1999
neelb420
fix this


Submitted On 26-NOV-1999
Jyotsana
This functionality should be provided. It is provided by all other libraries,
Then why not in Swing classes?


Submitted On 06-DEC-1999
dkf
FYI, maximisation is not a cross-platform concept.
Strange, but True!


Submitted On 09-DEC-1999
kananth1
Include for both restore(), maximize() and minimize() functions, 'll be more
helpful - thanks - ananth


Submitted On 10-JAN-2000
dkf
When you say restore() you really mean setState(NORMAL)
When you say minimize() you really mean setState(ICONIFIED)
But not all platforms have the built-in concept of maximisation;
in particular, X (i.e. Solaris) does not support this, and it was
taken out of the protocol long ago (no later than the early '90s)
so any request to maximise would be ignored there, or might
even put the system into an inconsistent state.
I would also question the utility of maximisation (other than for
presentations, which you can do right now with a Window) on
larger displays.  As people move on up from 17" towards 21" 
and beyond, GUIs that were designed to work on smaller
screens tend not to work too well.  I prefer to deal with this
problem by not maximising my apps on those systems...


Submitted On 10-FEB-2000
brianwells
At the very least I really need a way to determine if the JFrame IS maximized
or 'normal'.

My app saves the window's last position and size on exit and it gets messy if
the user happened to maximize the window :-(


Submitted On 17-FEB-2000
monschke
NOTE: This was reported more than 2 years ago.  In the top 10 now.  Why do we
vote?


Submitted On 29-FEB-2000
jrgchip
Surprised and disappointed this isn't available.
But, notice that current 1.2 implementation changes button, fills screen, makes window unmovable, and 
does not cover Windows taskbar.  Surely there is something we can interrogate to determine that the 
Window is in this pseudo-maximized state!  Anyone know?


Submitted On 20-MAR-2000
sperroud
I need this feature for our application too.
If we cannot set it by code, you must at least provide an 
event to catch the maximization.


Submitted On 22-MAR-2000
imagetec
I now that maximisation is not a cross-platform concept. 
But why in JInternalFrame we have properties like 
isMaximisable, maximize and others? and not in JFrame?


Submitted On 26-MAY-2000
achutapavan
This bug fixation is very important for providing
consistancy of application.


Submitted On 29-MAY-2000
SoftTouch
How was it fixed?


Submitted On 02-JUN-2000
javasun
is this java's anarchy or what that after two whole years of commenting on this bug u still dont have a 
release that would solve the simple maximize problems.


Submitted On 14-JUN-2000
dougvanhorn
Closed, fixed?  In a non-public release?  Does that mean JDK 1.3.1?  Little help, please...

(or did they close, fix this bug - status only?)


Submitted On 27-JUN-2000
khjippo
Hey, Sun. make better Java to developer


Submitted On 27-JUN-2000
khjippo
Hey, Sun. make better Java to developer


Submitted On 28-AUG-2000
nutulapati
I want to run Java application in full screen mode. Meaning 
I don't want to see title bar No Max/Min button.
I tried the workarounds that are given here. But none of 
them are working. I am still seeing title bar with Max/Min 
buttons on Windows NT


Submitted On 02-OCT-2000
noselasd
nutulapati
Use JWindow...
Not reel fullscreen mode anyway. but no titlebar/etc..


Submitted On 12-FEB-2001
blajev
I found a work-around witch is working on Windows with JDK 1.3 (better than nothing :-)
 using the java.awt.Robot class


if ( System.getProperty("os.name").startsWith("Windows") ) {
            try {
              java.awt.Robot rob = new java.awt.Robot();
              Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
              rob.mouseMove((int)(screenSize.getWidth() - 42),15);
              rob.mousePress(InputEvent.BUTTON1_MASK);
              rob.delay(10);
              rob.mouseRelease(InputEvent.BUTTON1_MASK);
              rob.delay(500);
              rob.mouseMove((int)(screenSize.getWidth()/2),(int)(screenSize.getHeight()/3));
            }catch(Exception ex){//ignore
            }
        }


Submitted On 06-JUN-2001
briansmith
blajev, your workaround assumes too much about the size and 
position of the title bar's buttons. In particular, for 
people who have the buttons really small or really large, I 
believe that you could end up actually minimizing or 
closing the window (respectively). Very unintuitive. You 
might try to send the keystrokes "Alt+SPACE" then 'X'.


Submitted On 18-OCT-2001
paulocd
If this is now closed and fixed, can anybody tell me how it 
has been fixed, in what version and what I need to do to 
maximize a frame.
Thanks.


Submitted On 26-OCT-2001
nishv
This feature need very much... Include all window resizing 
capabilities.


Submitted On 26-NOV-2001
koecki
I also need this feature. A state MAXIMIZED would be useful 
because in aw's workaround the original window size is 
overwritten.


Submitted On 09-AUG-2006
this is how u can do the same in code
************************
theMainFrame.setExtendedState(
          theMainFrame.getExtendedState() ||
          theMainFrame.MAXIMIZED_BOTH);
**************************
where theMainFrame is the JFrame u want to start maximized.



Submitted On 28-APR-2007
Steve_White
I don't see any mention of how this bug was fixed.

The question (in modern form) is how to maximize a JWindow.

Several responders proposed code to do that for a JFrame or a Frame.  We all know how to do that.  Now do it for a JWindow.

If this is now easy to do progammatically, please explain.
Otherwise, please re-open the bug report.


Submitted On 17-DEC-2008
Chris100
One idea is to first maximize a JFrame:

frame.setExtendedState(JFrame.MAXIMIZED_BOTH);

Then get the size of the frame and create a JWindow with that size:

window.setSize(frame.getSize());

Gives a maximized JWindow that works with the taskbar at the bottom of the screen (Win XP). With the taskbar in other locations I assume one has to adjust the window location but the size should remain the same.



PLEASE NOTE: JDK6 is formerly known as Project Mustang