import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.event.*;
import javax.swing.border.*;
public class Button extends JButton implements ActionListener { //*1 Similar to before
public Button (String label) { //*1
setText (label); //*2 Add some customization
setFont (new Font("Serif", Font.ITALIC, 18)); //*2
setForeground (Color.RED); //*2
setBorder (new LineBorder(Color.GREEN, 2)); //*2
addActionListener (this);
}
public void actionPerformed (ActionEvent e) { //*3 JButton uses ActionListener
System.out.println (getText() + " Button was pushed"); //*4 Retrieve text from JButton
}
}