<AWT Dev> Why does JFrame.setSize conflict with JFrame.setExtendedState?

Oleg Sukhodolsky Oleg.Sukhodolsky at Sun.COM
Tue Mar 25 14:05:33 PDT 2008

Hi Clemens,

Clemens Eisserer wrote:
> Hello,
> I have some code which first sets the size of a JFrame, was well as it
> maximizes it:
> setSize(new Dimension(800, 600));
> setVisible(true);
> setExtendedState(JFrame.MAXIMIZED_BOTH);

this is a valid code.

> I wonder wether this combination is "legal", because I always get
> different results with XAWT and also MAWT. No matter how I order the
> setSize/setExtendedState it seems to completly random.
> Sometimes I get a 800x600 window, somtimes its macimized and very
> seldom I get a window which is ~50px high and maximized horizontal.
> Shouldn't it simply open a 800x600 window and resize that to
> fullscreen once it has been realized on the native side?

Well it should either show 800x600 and maximize, or simply show maximized.

> Whats going on here?

Looks like a bug for me.

> My window-manager is KDE-3.5.8.

I have tried similar test on my KDE and usually I see correct behavior.
And sometimes I see non-maximized frame 800x600.  I've tested with 6u10 
b11.  What version do you use?

Regards, Oleg.

More information about the awt-dev mailing list