//Popup state to prevent feedback
boolean stateCmb = false;
//Extend JComboBox's length and reset it
public void popupMenuWillBecomeVisible(PopupMenuEvent e)
{
JComboBox cmb = (JComboBox)e.getSource();
//Extend JComboBox
cmb.setSize(NEW_LENGTH, cmb.getHeight());
//If it pops up now JPopupMenu will still be short
//Fire popupMenuCanceled...
if(!stateCmb)
cmb.firePopupMenuCanceled();
//Reset JComboBox and state
stateCmb = false;
cmb.setSize(OLD_LENGTH, cmb.getHeight());
}
//Show extended JPopupMenu
public void popupMenuCanceled(PopupMenuEvent e)
{
JComboBox cmb = (JComboBox)e.getSource();
stateCmb = true;
//JPopupMenu is long now, so repop
cmb.showPopup();
}public void popupMenuWillBecomeInvisible(PopupMenuEvent e) {
stateCmb = false;
}
Andy Burnham si avvicina alla guida del Labour e potrebbe sostituire
Starmer come primo ministro
-
Punti chiave Il politico Andy Burnham, favorito per succedere a Keir
Starmer come leader del Partito Laburista britannico, ha ricevuto
l'adesione di un imp...
4 giorni fa


Nessun commento:
Posta un commento