gpt4 book ai didi

java - 如何比 ComponentListener 更好地监听 componentShown/componentHidden 事件?

转载 作者:行者123 更新时间:2023-11-30 11:58:22 24 4
gpt4 key购买 nike

如果发生 componentShown/componentHidden 事件,我想得到通知。我使用 ComponentListener,但效果不如我需要。我在官方 Swing 教程中找到了这些信息:

The component-hidden and component-shown events occur only as the result of calls to a Component 's setVisible method. For example, a window might be miniaturized into an icon (iconified) without a component-hidden event being fired.

所以我想我必须找到另一个解决方案。那么如何监听每个 componentShown/componentHidden 事件呢?

最佳答案

我认为您无法通过单个监听器完成此操作。

您还可以使用 WindowListener 来监听 windowIconified。

关于java - 如何比 ComponentListener 更好地监听 componentShown/componentHidden 事件?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3219900/

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