using setExtendedState(javax.swing.JFrame.MAXIMIZED_BOTH); ...?

using setExtendedState(javax.swing.JFrame.MAXIMIZED_BOTH);JFrame Window will cover windows toolbar.how to create JFrame,make it max size,don't cover windows toolbar.
[194 byte] By [Kaede_Ja] at [2007-11-27 2:39:19]
# 1

import javax.swing.*;

import java.awt.*;

class Testing

{

public void buildGUI()

{

JFrame f = new JFrame();

f.setExtendedState(JFrame.MAXIMIZED_BOTH);

GraphicsEnvironment env = GraphicsEnvironment.getLocalGraphicsEnvironment();

f.setMaximizedBounds(env.getMaximumWindowBounds());

f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

f.setVisible(true);

}

public static void main(String[] args)

{

SwingUtilities.invokeLater(new Runnable(){

public void run(){

new Testing().buildGUI();

}

});

}

}

Michael_Dunna at 2007-7-12 3:01:14 > top of Java-index,Desktop,Core GUI APIs...
# 2
haha Thank you~!
Kaede_Ja at 2007-7-12 3:01:14 > top of Java-index,Desktop,Core GUI APIs...
# 3

> JFrame Window will cover windows toolbar.

I comment out:

//GraphicsEnvironment env = GraphicsEnvironment.getLocalGraphicsEnvironment();

//f.setMaximizedBounds(env.getMaximumWindowBounds());

And the code still worked correctly for me. I'm using JDK1.4.2 on XP. Is this a version issue or a coding problem?

camickra at 2007-7-12 3:01:14 > top of Java-index,Desktop,Core GUI APIs...
# 4

commenting out the lines also works OK for me on

java 1.5.0_05 winxp pro

java 1.4.2_08 winxp pro

but I had the OP's covering of the taskbar problems on

java 1.4.0_01 win98se

no longer have access to that config, so perhaps it was an older version problem,

perhaps an OS problem?

Michael_Dunna at 2007-7-12 3:01:14 > top of Java-index,Desktop,Core GUI APIs...
# 5
> but I had the OP's covering of the taskbar problems on java 1.4.0_01 win98seI don't remember the problem when I used JDK1.4.2 on Win98 (but at least we know the solution).
camickra at 2007-7-12 3:01:14 > top of Java-index,Desktop,Core GUI APIs...