本文介绍了容器在验证后不会自动调整大小的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
通过 add
和 remove
手动交换组件后,我调用 validate()
放在容器上。根据文档,
After manually swapping components via add
and remove
, I invoke validate()
on the container. According to the documentation,
短语 再次布置其子组件使我认为容器会相应地调整自身大小,但不会。相反,在调用 validate()
之后,我还需要调用 pack()
以便查看其所有子组件。 。
The phrase "lay out its subcomponents again" makes me think that the container will resize itself accordingly, but it doesn't. Instead, after invoking validate()
, I need to invoke pack()
as well in order to view all its subcomponents.
为什么?我是在做错什么吗?
Why is this? Am I doing something wrong?
推荐答案
(可能是由于这种含糊不清,说明在)
(may be due this ambiguity the description is changed in latest javaDoc )
是 NOT 的说法,
而再次需要 pack()
。
请注意清楚地说,
这篇关于容器在验证后不会自动调整大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!