JFrame.setExtendedState实际上没有最大化 [英] JFrame.setExtendedState doesn't actually maximise

查看:151
本文介绍了JFrame.setExtendedState实际上没有最大化的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

public static void main(String args[]){
    JFrame frame = new JFrame();
    frame.setExtendedState(JFrame.MAXIMISED_BOTH);
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.setVisible(true);
}

我已使用此代码最大化JFrame,但并未实际最大化框架,而是仅将窗口大小设置为屏幕的大小,而没有实际更改状态,因此单击最大化"按钮实际上并不会缩小再来一次.

I've used this code to maximise a JFrame, but instead of actually maximising the frame, it just sets the window size to that of the screen, without actually changing the state, so clicking the maximize button doesn't actually downscale it again.

我使用了错误的命令吗?

Am I using the wrong command or something?

推荐答案

frame.setExtendedState(JFrame.MAXIMISED_BOTH);

您应该改写frame.setExtendedState(JFrame.MAXIMIZED_BOTH);

这篇关于JFrame.setExtendedState实际上没有最大化的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆