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:
JOptionPane after the error, after click on the button "Yes"
The JOptionPane is created from class who extends from JComponent, in this line of code:
JOptionPane.showConfirmDialog(getParent().getParent(),
"The end! Lifes = 0");
I suspect that your panel's implementation of paintComponent()
fails to invoke super.paintComponent()
, as shown in this Q&A.