question: public void popupMenuCanceled ( PopupMenuEvent e ) { if ( shouldActLikeButton ( ) || pressedWhenPopupVisible ) { comboBox . repaint ( ) ; } }
target:  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