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: 4464714
Votes 12
Synopsis Windows: Frames cannot be shown initially maximized
Category java:classes_awt
Reported Against merlin-beta
Release Fixed 1.4.2(mantis)
State 10-Fix Delivered, bug
Priority: 4-Low
Related Bugs 4527549
Submit Date 31-MAY-2001
Description




java version "1.4.0-beta"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.0-beta-b65)
Java HotSpot(TM) Client VM (build 1.4.0-beta-b65, mixed mode)

Frames can be programmatically maximized with
setExtendedState() but only after having being shown,
otherwise they are shown in normal state, as the sample
code shows.
The workaround is to first show the frame, then maximize it.

//--------------------------------------------
import javax.swing.*;

public class Maxim extends JFrame
{
 public static void main(String args[])
 {
  new Maxim();
 }

 public Maxim()
 {
  setDefaultCloseOperation(EXIT_ON_CLOSE);
  setExtendedState(MAXIMIZED_BOTH);
  show();
 }
}
//--------------------------------------------
(Review ID: 125293) 
======================================================================
Work Around




//--------------------------------------------
import javax.swing.*;

public class Maxim extends JFrame
{
 public static void main(String args[])
 {
  new Maxim();
 }

 public Maxim()
 {
  setDefaultCloseOperation(EXIT_ON_CLOSE);
  show();
  setExtendedState(MAXIMIZED_BOTH);
 }
}
//--------------------------------------------
======================================================================
Evaluation
Windows part is resolved (see evaluation and suggested fix for 4464710), but on
X11 this is still impossible.
 xxxxx@xxxxx  2002-09-03
Comments
  
  Include a link with my name & email   

Submitted On 01-FEB-2002
MatsonWade
The user can see the app being painted first in normal 
mode, then expand to maximized (using the workaround). It's 
very unsightly, and the initial user impression is that 
every disparaging remark about client-side Java is true. 
For us Java application developers this is a critical bug 
to fix because first impressions are very important. Please 
don't sell us short by not fixing in a timely fashion such 
a critical bug. This affects user acceptance of our 
applications.


Submitted On 19-APR-2002
GaffneyC
import javax.swing.*;
public class MaximizedWindow extends JFrame {
   public MaximizedWindow() {
      // Add stuff

      // Realizes the frame but does not show it
      pack();
      setExtendedState(MAXIMIZED_BOTH);
   }
   public static void main(String args[]) {
      new MaximizedWindow().show();
   }
}

The problem really stems from the Frame not having been 
realized. This is done by calling setVisible(true), show
(), or pack(). After the frame has been realized you can 
maximize it.


Submitted On 16-OCT-2002
aschon
Great catch on using pack() as a workaround before calling 
setExtendedState(JFrame.MAXIMIXED_BOTH). 


Submitted On 03-MAR-2004
Alexander123
If this still isn't fixed under X11, why is the bug closed??


Submitted On 20-OCT-2007
Plumpaquatsch
It is still not working under Windows XP JRE 1.5.0 and 1.6.0, if you set the content pane. You can reproduce it with this example by adding the line setContentPane(new JPanel()) in the constructor of Maxim. This bug should be reopened.



PLEASE NOTE: JDK6 is formerly known as Project Mustang