import java.awt.*;
import javax.swing.*;
import javax.swing.border.*;
import javax.swing.plaf.*;

public class MyJButton extends JButton {

	static final ImageIcon normal = MyToggleButton.normal;
	static final ImageIcon pressed = MyToggleButton.pressed;
	static final ImageIcon disabled = MyToggleButton.disabled;

	public MyJButton() {
		super();
	}
	
	public MyJButton(Icon icon) {
		super(icon);
	}

	/*public MyJButton(String text) {
		super(text);
	}

	public MyJButton(String text, Icon icon) {
		super(text,icon);
	}
	*/
    protected void paintComponent(Graphics g) {
		Icon icon = normal;
		if (!isEnabled()) icon = disabled;
        //else if (isSelected()) icon = pressed;
		else if (getModel().isArmed()) icon = pressed;
		g.drawImage(((ImageIcon)icon).getImage(),2,3,getWidth()-2,getHeight()-3,0,0,icon.getIconWidth(),icon.getIconHeight(),null);
		if (!isEnabled()) icon = getDisabledIcon();
		else icon = getIcon();
		icon.paintIcon(this,g,getWidth()/2-icon.getIconWidth()/2,getHeight()/2-icon.getIconHeight()/2);
    }
}
