gpt4 book ai didi

java - 网 bean : how to resize the UI Window to screen Size

转载 作者:行者123 更新时间:2023-11-30 06:33:28 25 4
gpt4 key购买 nike

我正在使用 Netbeans 使用 Java 开发一个小型应用程序。我使用 JFrame 作为基础控件,并根据需要将所有必需的控件拖放到它上面。

应用程序运行正常,符合预期。现在我只是希望当我的应用程序第一次运行时,我的应用程序窗口的大小应该等于我的屏幕大小。简而言之,我希望我的应用程序在打开时最大化。以下是我的主要方法的代码:

public static void main(String args[]) {
java.awt.EventQueue.invokeLater(new Runnable() {

public void run() {
MyUI myframe = new MyUI();
myframe.setTitle("my tiltle");
myframe.setVisible(true);
//new GPrideUI().setVisible(true);
}
});
}

最佳答案

参见 Frame.setExtendedState(int)其中:

Sets the state of this frame. The state is represented as a bitwise mask.

  • NORMAL Indicates that no state bits are set.
  • ICONIFIED
  • MAXIMIZED_HORIZ
  • MAXIMIZED_VERT
  • MAXIMIZED_BOTH Concatenates MAXIMIZED_HORIZ and MAXIMIZED_VERT.

关于java - 网 bean : how to resize the UI Window to screen Size,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7860664/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com