有没有办法判断JFrame是否为“最大化"? (MS Windows) [英] Is there a way to tell if a JFrame is "Maximised" (MS Windows)

查看:72
本文介绍了有没有办法判断JFrame是否为“最大化"? (MS Windows)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我曾经在OS X上使用过Java应用程序,却没有机会在不同的地方进行全面测试.

I've been Java applications on OS X, and haven't had the opportunity to fully test in different places.

有2个不同的JFrame.完全加载了第二个,而不是第一个,因此需要将其大小和位置设置为与第一个相同.

There are 2 different JFrames. The second is loaded exactly in place of the first one, and as such needs to have its size and location set to the same as the first.

这很好,但是我注意到许多Windows用户似乎都在最大化第一个窗口.当第二个JFrame加载时,它具有相同的大小,但没有最大化".

This works fine, but I noticed a lot of Windows users seem to maximise the first window. When the second JFrame loads, it has the same size, but is not "maximised".

MS Windows世界中最大化的窗口的状态略有不同,并且操作系统对其的处理方式也有所不同.

Maximised windows in the MS Windows world have a slightly different state and are treated differently by the OS.

如何确定JFrame是否已最大化,以及如何自己最大化JFrame?

How can I tell if a JFrame is Maximised, and how can I maximise one myself?

推荐答案

frame.setExtendedState( f.getExtendedState()|JFrame.MAXIMIZED_BOTH );

这篇关于有没有办法判断JFrame是否为“最大化"? (MS Windows)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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