Java JButton Create makeButton(String name, ActionListener l)

Here you can find the source of makeButton(String name, ActionListener l)

Description

Return a button with action command set to name.

License

Open Source License

Parameter

Parameter Description
name a parameter
l a parameter

Declaration

public final static JButton makeButton(String name, ActionListener l) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import java.awt.event.ActionListener;

import javax.swing.JButton;

public class Main {
    /**// ww  w  . j a v a 2 s. c o m
     * Return a button with action command set to name.
     * 
     * @param name
     * @param l
     * @return
     */
    public final static JButton makeButton(String name, ActionListener l) {
        JButton button = new JButton(name);
        button.addActionListener(l);
        button.setActionCommand(name);
        return button;
    }
}

Related

  1. createToolBarButton(String text, Icon icon)
  2. createToolBarToggleButton(ImageIcon ic, String toolTip, ActionListener al)
  3. createTransparentButton(Action action, boolean withText)
  4. getCreateButton()
  5. makeButton(Action action)
  6. makeButtonActLikeLabel(JButton button)
  7. makeButtonBar(int align, Component... comps)
  8. makeButtonFlat(AbstractButton button)
  9. makeButtonPanel(Vector names, ActionListener actionListener)