Java examples for Swing:Action
Remove all action listeners from a button Swing AbstractButton.
//package com.java2s; import java.awt.event.ActionListener; import javax.swing.AbstractButton; public class Main { /**/*w w w .j av a 2 s . c o m*/ * Remove all action listeners from a button. * * @param button Button. */ public static void removeActionListeners(AbstractButton button) { if (button == null) { return; } ActionListener[] listeners = button.getActionListeners(); if (listeners == null) { return; } for (ActionListener listener : listeners) { button.removeActionListener(listener); } } }