home *** CD-ROM | disk | FTP | other *** search
Java Source | 1999-11-28 | 1.3 KB | 51 lines |
- /*
- * @(#)ColourDemo.java 1.0 99/11/27
- *
- * Copyright (c) 1999, David Griffiths. All Rights Reserved.
- *
- * This software is the proprietary information of David Griffiths.
- * This source code may not be published or redistributed without the
- * express permission of the author.
- *
- * THE AUTHOR MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE SUITABILITY
- * OF THE SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
- * PURPOSE, OR NON-INFRINGEMENT. THE AUTHOR SHALL NOT BE LIABLE FOR ANY DAMAGES
- * SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR DISTRIBUTING
- * THIS SOFTWARE OR ITS DERIVATIVES.
- *
- */
-
- import java.awt.*;
- import java.awt.event.*;
- import com.sun.java.swing.*;
- import com.sun.java.swing.preview.*;
-
- /**
- * A very simple applet.
- */
- public class ColourDemo extends JApplet implements ActionListener {
-
- private JButton btnChange;
-
- public void init() {
- btnChange = new JButton("Click to change my colour!");
-
- btnChange.addActionListener(this);
-
- getContentPane().add(btnChange);
- }
-
- public void actionPerformed(ActionEvent e) {
- btnChange.setBackground(
- JColorChooser.showDialog(
- this,
- "ColourDemo's colour chooser",
- Color.white
- )
- );
- }
- }
-
-
-