Note that if the state is not supported on a given platform, nothing will happen. The application may determine if a specific state is available via the java.awt.Toolkit#isFrameStateSupported(int state) method. 用Toolkit#isFrameStateSupported( Frame.MAXIMIZED_BOTH )测试一下,看是否支持。
public void setExtendedState(int state)
可以设置
参数可以为:
NORMAL
Indicates that no state bits are set.
ICONIFIED
MAXIMIZED_HORIZ
MAXIMIZED_VERT
MAXIMIZED_BOTH
你的要求用最后一个---------或------------
MainFrame mainFram=new MainFrame();
Dimension dm=Toolkit.getDefaultToolkit().getScreenSize();
mainFram.setSize(dm);
mainFram.setLocation(0,0);
mainFram.setVisible(true);
我想问这是为什么
这样写