|
import javax.swing.ImageIcon;
|
|
public class cCheckBox extends javax.swing.JCheckBox
|
{
|
cCheckBox(String name, boolean enabled)
|
{
|
super(name, enabled);
|
|
setBorder(new javax.swing.border.EmptyBorder(0, 0, 0, 0));
|
//setBorder(new javax.swing.border.EtchedBorder());
|
}
|
|
cCheckBox(ImageIcon icon, boolean enabled)
|
{
|
super("", enabled);
|
|
this.image = icon.getImage();
|
iconWidth = icon.getIconWidth();
|
|
setBorder(new javax.swing.border.EmptyBorder(8, 0, 8, 24)); // top, left, bottom, right
|
//setBorder(new javax.swing.border.EtchedBorder());
|
}
|
|
private java.awt.Image image;
|
private int iconWidth;
|
|
@Override
|
protected void paintComponent(java.awt.Graphics g)
|
{
|
super.paintComponent(g);
|
if (image != null)
|
{
|
//if (getWidth() > image.getWidth(null) + 8)
|
{
|
g.drawImage(image, 18, 6, this);
|
}
|
}
|
}
|
}
|