当对象交互时,位于其他面板之上的 Jpanels 会消失。 - java swing接口
好的,我希望尽我所能解释这一点。
问题是我有一个带有棋盘游戏图像的外部 JPanel
和一个内部 JPanel
使用位置菜单、下一回合、掷骰子按钮等。
我让棋盘标记从棋盘的一侧移动到另一侧,但当发生这种情况时,棋盘的内部部分会消失。
我尝试执行 revalidate();
repaint();
以及外部和内部面板、板图像、按钮等的所有内容,但我仍然面临这个问题。
希望有人能帮忙。谢谢。
OK, I hope to explain this the best I can.
What's up is that I have an outer JPanel
with a board game image, and an inner JPanel
with the location menus, next turn, roll dice buttons etc.
I make my board markers move from one side of the board to the other, but the inside parts of the board disapear as this happens.
I tried doing revalidate();
repaint();
and everything for the outer, and inner panels, the board image, also buttons etc, but I'm still faced with this problem.
Hope someone can help. Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
看起来OP可能已经放弃了这一点,但我会在黑暗中进行一次完整的拍摄:尝试关闭一个(或两个?)容器上的optimizedDrawingEnabled标志。 Swing 期望兄弟姐妹永远不会重叠 - 如果重叠,您需要关闭该标志。
Looks like OP may have abandoned this, but I'll take a complete shot in the dark: try turning off the
optimizedDrawingEnabled
flag on one (or both?) of the containers. Swing expects that siblings never overlap - if they do, you need to turn off that flag.