gpt4 book ai didi

java - JOptionPane 在 JPanel 中不能正常工作

转载 作者:行者123 更新时间:2023-11-29 03:37:23 24 4
gpt4 key购买 nike

在我的游戏中,当我创建 JOptionalPane 时,在我单击“确定”按钮后,它会在面板上绘制对话框。以下是错误的图片。

错误前的JOptionPane:

enter image description here

JOptionPane 报错后,点击按钮"is"后

enter image description here

JOptionPane 是从扩展自 JComponent 的类创建的,在这行代码中:

JOptionPane.showConfirmDialog(getParent().getParent(),
"The end! Lifes = 0");

最佳答案

我怀疑您的面板对 paintComponent() 的实现无法调用 super.paintComponent(),如 Q&A 所示.

关于java - JOptionPane 在 JPanel 中不能正常工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14799175/

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