Java JButton Create createButton16(final ImageIcon icon)

Here you can find the source of createButton16(final ImageIcon icon)

Description

create Button

License

Open Source License

Declaration

public static JButton createButton16(final ImageIcon icon) 

Method Source Code

//package com.java2s;

import java.awt.Dimension;

import java.awt.Insets;

import javax.swing.ImageIcon;

import javax.swing.JButton;

public class Main {
    public static JButton createButton16(final ImageIcon icon) {
        return createButton16(icon, null);
    }/*  w w w  . ja v  a 2 s  . co  m*/

    public static JButton createButton16(final ImageIcon icon, final String toolTip) {
        final JButton newButton = new JButton();
        newButton.setMargin(new Insets(0, 0, 0, 0));
        newButton.setMinimumSize(new Dimension(16, 16));
        if (toolTip != null) {
            newButton.setToolTipText(toolTip);
        }
        newButton.setIcon(icon);
        return newButton;
    }
}

Related

  1. createButton(String aText, String aTooltip, ActionListener aListener)
  2. createButton(String name, ActionListener listener)
  3. createButton(String name, int x, int y, int width, int height, ImageIcon imageIcon)
  4. createButton(String text, boolean parse)
  5. createButton(String text, String icon)
  6. createButtonFooter(JButton ok, JButton cancel)
  7. createButtonGroup(javax.swing.AbstractButton... buttons)
  8. createButtonPanel()
  9. createButtonRow(List buttons)