1

In my game, when I create a JOptionalPane, after I click on the "Ok" button, it draws the dialog over the panel. Below are pictures of the error.

JOptionPane before the error:

enter image description here

JOptionPane after the error, after click on the button "Yes"

enter image description here

The JOptionPane is created from class who extends from JComponent, in this line of code:

JOptionPane.showConfirmDialog(getParent().getParent(),
        "The end! Lifes = 0");
Hovercraft Full Of Eels
  • 283,665
  • 25
  • 256
  • 373
Andrew Valevskiy
  • 529
  • 3
  • 7
  • 18

1 Answers1

4

I suspect that your panel's implementation of paintComponent() fails to invoke super.paintComponent(), as shown in this Q&A.

Community
  • 1
  • 1
trashgod
  • 203,806
  • 29
  • 246
  • 1,045
  • Thank you very much! After creating JOptionPane I called repaint() and now after click on "Yes" the JOptionPane draws over panel and quickly remove – Andrew Valevskiy Feb 10 '13 at 16:01