开发者

How to find real height of panel?

开发者 https://www.devze.com 2023-02-28 22:51 出处:网络
If I set the size of a JPanel by using for instance the method setPreferedSize(new Dimension(0,160,10,10)) but then I add a lot o开发者_JAVA百科f other components (for instance a series of big buttons

If I set the size of a JPanel by using for instance the method setPreferedSize(new Dimension(0,160,10,10)) but then I add a lot o开发者_JAVA百科f other components (for instance a series of big buttons) and the panel exceeds the size of 160px: how do I find the real height of panel ?


Use JComponent#getHeight(). From its JavaDoc: Returns the current height of this component.

0

精彩评论

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