//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;
}
Vannacci lancia il suo movimento 'Il mondo al contrario': "Nessuna
spaccatura con Salvini"
-
Vannacci lancia il suo movimento 'Il mondo al contrario': "Nessuna
spaccatura con Salvini"
Canali: Biella
9 ore fa
Nessun commento:
Posta un commento