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.
ItemListener
generally fires two events. The first is aDSESELECTED
event (the old value) and aSELECTED
event (the new value).You could monitor these changes, recording the
DESELECTED
value as they occurAs a test, you could try something like this...
If the user selects "no" to the change, you could restore the
DESELECTED
value...