Java JButton Settings addActionListenerToButtons(ActionListener l, AbstractButton... components)

Here you can find the source of addActionListenerToButtons(ActionListener l, AbstractButton... components)

Description

This Method adds a Actionlistener to Several AbstractButtons

License

Apache License

Parameter

Parameter Description
l the Listener to add
components The buttons to add the Listener to

Declaration

public static void addActionListenerToButtons(ActionListener l, AbstractButton... components) 

Method Source Code


//package com.java2s;
//License from project: Apache License 

import javax.swing.AbstractButton;

import java.awt.event.ActionListener;

public class Main {
    /**//from  ww w  .j a v a  2s.c  o  m
     * This Method adds a Actionlistener to Several AbstractButtons
     * @param l the Listener to add
     * @param components The buttons to add the Listener to
     */
    public static void addActionListenerToButtons(ActionListener l, AbstractButton... components) {
        for (AbstractButton component : components) {
            component.addActionListener(l);
        }
    }
}

Related

  1. addAbstractButtonListeners(AbstractButton b, Object... objs)
  2. addActionListener(ActionListener listener, AbstractButton... buttons)
  3. addActionListeners(AbstractButton button, ActionListener[] listeners)
  4. addButton(ActionListener l, Container container, String name, String cmd)
  5. addButton(Container component, String text, Icon icon, ActionListener listener, String actionCommand)
  6. addButton(String name, JPanel panel, ActionListener action)
  7. addButtonInPanel(Container component, String text, ActionListener listener)