FileDocCategorySizeDatePackage
ColorChooser.javaAPI DocExample1762Sun Mar 11 21:11:46 GMT 2001None

ColorChooser

public class ColorChooser extends JFrame

Fields Summary
JColorChooser
cc
JDialog
cd
MyCanvas
demo
Constructors Summary
public ColorChooser()

        super("Ian Darwin's Color Demo");
        JButton jButton;
		Container cPane = getContentPane();
        cPane.add("North", jButton = new JButton("Choose Color..."));
		jButton.setToolTipText("Click here to see the Color Chooser");
        jButton.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent actionEvent)
			{
				ColorChooser.this.cd.setVisible(true);
			}
		});
        cPane.add("Center", demo = new MyCanvas(300,150));
		demo.setToolTipText("This is the last color you chose");
        pack();
        addWindowListener(new WindowAdapter() {
			public void windowClosing(WindowEvent windowEvent)
			{
				System.exit(0);
			}
		});
        cd = JColorChooser.createDialog(this,
			"Ian Darwin's Color PopUp",
			true,
			cc = new JColorChooser(getBackground()),
			new ActionListener() {
				public void actionPerformed(ActionEvent actionEvent) {
					ColorChooser.this.demo.setColor(cc.getColor());
				}
			},
			new ActionListener() {
				public void actionPerformed(ActionEvent actionEvent)
				{
					ColorChooser.this.demo.setColor(getBackground());
				}
			});
	
Methods Summary
public static voidmain(java.lang.String[] astring)

        new ColorChooser().setVisible(true);