package graphics.carl;
public abstract class CommandButton extends javax.swing.JButton
implements java.awt.event.ActionListener, Runnable {
public CommandButton(String s) {
super(s);
addActionListener(this);
}
public void actionPerformed(java.awt.event.ActionEvent e) {
run();
}
public static void main(String args[]) {
System.out.println("Testing graphics.carl.CommandButton via main");
java.awt.Frame f = new java.awt.Frame();
f.setLayout(new java.awt.GridLayout(1, 0));
f.add(new CommandButton("Testing command button") {
public void run() {
System.out.println("gui.run in cb");
setBackground(java.awt.Color.green);
}
}
);
f.setSize(200, 200);
f.setBackground(java.awt.Color.red);
f.show();
}
}