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

Oleg Sukhodolsky Oleg.Sukhodolsky at Sun.COM
Tue Mar 25 22:59:37 PDT 2008

Hi Clemens,

Clemens Eisserer wrote:
> Hi Oleg,
> Thanks a lot for anwering.
>> Well it should either show 800x600 and maximize, or simply show
>> maximized.
> Yes that was also my assumption.
> The idea behind the code was that the window should show up maximized,
> and when the user clicks on the maximize icon/button in the
> window-title-bar, the JFrame should resize to the 800x600 size.
>> 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?
> I tested with 6u10b13, but saw the same behaviour till back to
> JDK-1.4.2, and also with 6u10 and MAWT.
> I see the same behaviour as you. Usually it opens up with 800x600 and
> maximizes, but sometimes it simply stays at 800x600.
> Could it be that there's a race somewhere, and the window-manager gets
> the command to maximize before the command to set the window to
> 800x600?
> Sleeping 100ms between resizing and maximizing it works reliable:
> setVisible(true);
> setSize(800, 600);
> sleep(100);
> setExtendedState(MAXIMIZED_BOTH);
> With JDK7b19 I somtimes see the window maximized only horizontal (1280
> on my laptop) but only 50px high, which is of course even worse,
> however I never see it 800x600.
> Any ideas where this could come from? Adding XSync() to
> XBaseWindow.setBounds does not help ;)

Honestly I do not know what may be cause of the problem (perhaps others 
have some insight).  But this can be even bug in Kwin.  Could you, 
please, file bug about this and we will investigate this (as soon as 
someone will have time ;)

Regards, Oleg.
> Thanks a lot, lg Clemens
> PS: this has really low priority for me, I just found it and thought
> its worth reporting. I hope I don't steal any time away ...

More information about the awt-dev mailing list