public void mouseExited(MouseEvent e) {
   // Remove overlay only if the dialog isn't visible
   if (!popupMenu.isVisible()) {
     this.drawOverlay = false;
     this.repaint();
   }
 }
 public void mouseReleased(MouseEvent e) {
   showDialog(e, !popupMenu.isVisible());
 }