import java.awt.Color;
import javax.swing.*;
import java.awt.event.*;

    // Always quit an application when pressed.
class QuitJButton extends JButton implements ActionListener {
    public QuitJButton(String s,Icon i){
        super(s,i);
        addActionListener(this);
    }

    public QuitJButton(String s){
        this(s,null);
    }

    public QuitJButton(Icon i){
        this("",i);
    }

    public QuitJButton(){
        this(label,null);
    }

    public void actionPerformed(ActionEvent e){
        // Exit is prohibited from an applet.
        try{
            System.exit(0);
        }
        catch(RuntimeException ex){
        }
    }

    private static final String label = "Quit";
    {
        setBackground(Color.white);
    }
}
