gpt4 book ai didi

java - OverlayLayout 不尊重焦点变化的叠加顺序

转载 作者:行者123 更新时间:2023-12-04 05:36:49 25 4
gpt4 key购买 nike

我遇到了 OverlayLayout 的问题.

基本上,我创建了一个组件,它允许在主要内容(如下拉菜单)上方展开覆盖内容。它有效!

问题是:如果我放一个 JButton在主要内容(下面的内容)上,当我单击此按钮时,该按钮开始出现在叠加内容上方!
我不知道为什么?

有谁知道问题是什么?可能是重点?

最佳答案

我终于找到了答案!
它来自 another post在计算器上...

When components overlap on the panel then you need to tell the panel so it can make sure it repaints the components in their proper ZOrder:

You do this by overriding the isOptimizedDrawingEnabled() method of the JPanel to return false.

关于java - OverlayLayout 不尊重焦点变化的叠加顺序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11825701/

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