public void popupMenuCanceled(PopupMenuEvent e){
  if (shouldActLikeButton() || pressedWhenPopupVisible) {
    comboBox.repaint();
  }
}

public void popupMenuCanceled ( PopupMenuEvent e ) { if ( shouldActLikeButton ( ) || pressedWhenPopupVisible ) { comboBox . repaint ( ) ; } }
this method is called when the popup menu is canceled ensures that the combo box is repainted when the popup is closed . this avoids a bug where clicking off the combo wasn ' t causing a repaint , and thus the combo box still looked pressed even when it was not . this bug was only noticed when acting as a button , but may be generally present . if so , remove the if ( ) block
