All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.habibsweb.commons.components.ImageButton Maven / Gradle / Ivy

There is a newer version: 1.0.2
Show newest version
/*
 * 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);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy