mousePressed stays true after any JOptionPane.showMessageDialog

Hello,

I am encountering a problem with one of my programs where I use the JOptionPane.showMessageDialog.

After the message dialog the mousePressed stays true causing unwanted actions. code below.
Even running the JOptionPane.showMessageDialog from a thread does not help.

Is there a soltuion to this behaviour?

Thanks in advance.
Sebastiaan.

import javax.swing.JOptionPane;

void setup() {
  size(500,500);
  textSize(20);
}

void draw() {
background(128); 
fill(255);
rect(50,250,400,200);
fill(0);
text("Click here for MessageDialog",90, 350);
text("mousePressed status: " + (mousePressed), 90 ,  125);
}

void mousePressed() {
 if (mouseX > 50 && mouseX < 450 && mouseY > 250 && mouseY < 450) thread("MessageDialog_thread");
} 

void MessageDialog_thread(){
  JOptionPane.showMessageDialog(null,"mousePressed turns and stays true, even after pressing OK.","Message",JOptionPane.PLAIN_MESSAGE);
}
// ...

boolean busy;

// ...

void mousePressed() {
  if (busy)  return;

  // ...
}

void MessageDialog_thread() {
  busy = true;

  // ...

  busy = false;
}