You should probably take a look at the JToggleButton class. Associate it with an action that calls setEnabled (false) to disable interaction.
After your event, you call setEnabled (true) and setSelected (false) to restore the button to its original state.
source share