开发者

How do you find out the REAL size of a JFrame?

I have a 开发者_运维技巧JFrame which is maximized (frame.setExtendedState(JFrame.MAXIMIZED_BOTH)).

I want to find out the size it is now extended to, but frame.getSize() returns a size of (0, 0).


The frame won't have the maximized size until you make it visible. So your basic code would be:

frame.setExtendedState(JFrame.MAXIMIZED_BOTH);
frame.setVisible(true);
System.out.println(frame.getSize());


Using setExtendedState I got output in jframe java.awt.Dimension[width=408,height=334]. Please check your code.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜