【问题标题】:How to run JFrame maximized in JAVA? [duplicate]如何在 JAVA 中最大化运行 JFrame? [复制]
【发布时间】:2013-03-22 17:40:26
【问题描述】:

我是 JAVA 新手。

我需要在最大化模式下运行一个名为 MainFrame 的 JFrame。

我该怎么做?

public class MainFrame extends javax.swing.JFrame {

/**
 * Creates new form MainFrame
 */
public MainFrame() {
    initComponents();
}

【问题讨论】:

    标签: java swing jframe


    【解决方案1】:

    你应该使用JFrame.setExtendedState:

    public MainFrame() {
        initComponents();
        setExtendedState(java.awt.Frame.MAXIMIZED_BOTH);
    }
    

    【讨论】:

    • 非常感谢。这很有帮助。
    • 我上次使用 Red Hat Enterprise Linux 时,框架必须可见才能设置扩展状态。尽管有订单,但它在 Windows 上运行良好。我不确定这是否仍然是一个问题。
    • 刚刚在 Windows 8.1 上进行了测试:框架必须可见才能正常工作。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-01-02
    • 1970-01-01
    • 2014-07-10
    • 1970-01-01
    • 1970-01-01
    • 2011-07-12
    相关资源
    最近更新 更多