如何获得JFrame的extendedState宽度 [英] How to get extendedState width of JFrame

查看:47
本文介绍了如何获得JFrame的extendedState宽度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

  • 我有一个JFrame,其扩展状态选项设置为MAXIMIZE_BOTH

  • I have a JFrame of which extended state option is set to MAXIMIZE_BOTH

当我想获取JFrame的宽度时,它将返回0.

When i want to get the width of the JFrame it returns 0.

那为什么?

推荐答案

  • 我有一个JFrame,其扩展状态选项设置为MAXIMIZE_BOTH
  • I have a JFrame of which extended state option is set to MAXIMIZE_BOTH

JFrame.getExtendedState( )返回正确的状态

  • 当我想获取JFrame的宽度时,它返回0.
  • When i want to get the width of the JFrame it returns 0.

任何经过协调的人都可以在

any coordinated are accesible after

  1. pack()被称为

用于屏幕上已经可见的容器

for already visible container on the screen

这篇关于如何获得JFrame的extendedState宽度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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