Wumbo4Dayz
Wumbo4Dayz

Reputation: 75

Replacing an old ActionListener for a button with a new one

I was wondering (if possible) how I could update what a JButton's ActionListener performs. I need to keep one button throughout my whole program, but change what it does depending on the current situation.

Upvotes: 0

Views: 1280

Answers (1)

ferrerverck
ferrerverck

Reputation: 618

At first use removeActionListener() than add new one. Use getActionListeners method to get list of all action listeners for your button.

Upvotes: 2

Related Questions