com.habibsweb.commons.components.ImageButton Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of selectlistbox Show documentation
Show all versions of selectlistbox Show documentation
List box with multiple ways to select including a selection rectangle
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package com.habibsweb.commons.components;
import java.awt.Insets;
import javax.swing.ImageIcon;
import javax.swing.JButton;
/**
* A JButton
that uses is set to the size and displays an
* ImageIcon
*
* @author David Hamilton
*/
public class ImageButton extends JButton {
/**
* Constructs a new ImageButton
from a provided
* ImageIcon
*
* @param icon a provided ImageIcon
*/
public ImageButton(ImageIcon icon) {
setSize(icon.getImage().getWidth(null), icon.getImage().getHeight(null));
setIcon(icon);
setMargin(new Insets(0, 0, 0, 0));
setBorderPainted(false);
setBorder(null);
setText(null);
}
}