Java JFrame调整大小 [英] Java JFrame Resizing

查看:330
本文介绍了Java JFrame调整大小的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道我可以在用户调整窗口大小时使用componentResized进行监听.这不是一个很好的解决方案.如果执行此操作,并为子组件添加resize()方法,则它会等到用户完成大小调整后再调用resize()方法.有没有办法在调整大小时调整子元素的大小?

I know I can use componentResized to listen for when the user resizes a window. This isn't a very nice solution. If I do this and add a resize() method for the children components, then it waits until the user finishes the resizing before it calls the resize() method. Is there a way to resize the child elements as the resize happens?

推荐答案

带有componentResized()的侦听器是不错的解决方案.在摆动中使用监听器根本不是一个坏方法.

The listener with componentResized() is the nice solution. Using listener in swing isn't a bad solution at all.

您可以在 oracle.com

这篇关于Java JFrame调整大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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