当我 repaint() 放置 JLabels 的面板时,出现错误,但它仍然有效。我试着把 panel.repaint(); try 语句中的代码,但没有帮助。还有其他人对 JPanel 的 repaint() 有问题吗?
错误消息(从评论中复制):
Exception in thread "AWT-EventQueue-0" java.lang.ArrayIndexOutOfBoundsException: No such child: 21
at java.awt.Container.getComponent(Unknown Source)
at javax.swing.JComponent.rectangleIsObscured(Unknown Source)
at javax.swing.JComponent.paint(Unknown Source)
at javax.swing.JComponent.paintToOffscreen(Unknown Source)
at javax.swing.RepaintManager$PaintManager.paintDoubleBuffered(Unknown Source)
at javax.swing.RepaintManager$PaintManager.paint(Unknown Source) )