home *** CD-ROM | disk | FTP | other *** search
- import com.sun.java.swing.JApplet;
- import com.sun.java.swing.JButton;
- import com.sun.java.swing.preview.JColorChooser;
- import java.awt.Color;
- import java.awt.event.ActionEvent;
- import java.awt.event.ActionListener;
-
- public class ColourDemo extends JApplet implements ActionListener {
- private JButton btnChange;
-
- public void init() {
- this.btnChange = new JButton("Click to change my colour!");
- this.btnChange.addActionListener(this);
- ((JApplet)this).getContentPane().add(this.btnChange);
- }
-
- public void actionPerformed(ActionEvent var1) {
- this.btnChange.setBackground(JColorChooser.showDialog(this, "ColourDemo's colour chooser", Color.white));
- }
- }
-