Is there any way to keep user on old selected option from JComboBox. There is one confirmation I am asking to user when he/she wan't to change JComboBox's selected item, if user say yes, then only I want to keep new selection else set old item selected.
Is there any way to restrict JComboBox selection? I am using ItemListener and MouseListener to achieve above functionality.
ItemListenergenerally fires two events. The first is aDSESELECTEDevent (the old value) and aSELECTEDevent (the new value).You could monitor these changes, recording the
DESELECTEDvalue as they occurAs a test, you could try something like this...
If the user selects "no" to the change, you could restore the
DESELECTEDvalue...