如何设置在netbeans平台上制作的我的应用程序的全屏模式? [英] How to set full Screen Mode of My App which is made in netbeans platform?
问题描述
我在 java.now 的 netbeans 平台中制作了桌面应用程序,现在当我运行我的应用程序时,它将默认打开 netbeans 平台配置的大小.但是当我运行或启动我的应用程序时,我想要全屏模式.那么在我的应用中在哪里以及如何做到这一点?
I m made Desktop App in netbeans platform in java.now wwhen i run my app it will open by default size of netbeans platform configuration.but i want full screen mode when i run or startup my app. so where and how to do that in my app?
推荐答案
如果你想在swing中打开默认最大化的JFrame,你可以使用JFrame.setExtendedState()
,如下图所示:
If you want to open the JFrame maximized by default in swing you can use JFrame. setExtendedState()
, illusrated below:
public class MyFrame extends JFrame{
public MyFrame() {
// Other codes
// Set the JFrame to maximize by default on opening
setExtendedState(JFrame.MAXIMIZED_BOTH);
// Rest of the program
}
}
还请记住,您不应该在相同的方法(这里是构造函数).
Also remember that you should not have JFrame.pack()
or JFrame.setMaximimumSize()
or JFrame.setSize()
in the same menthod (here constructor).
这篇关于如何设置在netbeans平台上制作的我的应用程序的全屏模式?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!