gpt4 book ai didi

java - 重新验证 JPanel 的父框架

转载 作者:行者123 更新时间:2023-11-30 06:37:56 25 4
gpt4 key购买 nike

当我显示/隐藏字段时,我希望我的面板适合框架。我如何通知父框架重新生效?

我考虑过将框架传递给我面板的构造函数,但我认为这可能已经完成了。我记得 JPanel 中有一个 protected 属性,但没有.. 可能我记错了组件。

最佳答案

I need show/hide some fields of my panel, and I want the panel to fit the frame.

您的意思是像摘要/详细信息 View ,并且您希望更改框架大小?然后尝试:

SwingUtilities.windowForComponent(...).pack();

关于java - 重新验证 JPanel 的父框架,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2806069/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com