Andrew Valevskiy
Andrew Valevskiy

Reputation: 559

JOptionPane doesn't work correct in JPanel

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");

Upvotes: 1

Views: 653

Answers (1)

trashgod
trashgod

Reputation: 205775

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

Upvotes: 4

Related Questions