Java tutorial
//package com.java2s; import java.awt.event.ActionListener; import javax.swing.AbstractButton; public class Main { /** * select silently * @param aButton button * @param isSelected indicates if button should be selected * @param aListener listener to be removed when selecting index */ public final static void SelectSilently(AbstractButton aButton, boolean isSelected, ActionListener aListener) { aButton.removeActionListener(aListener); aButton.setSelected(isSelected); aButton.addActionListener(aListener); } }