FileDocCategorySizeDatePackage
ColorChooser.javaAPI DocExample1802Sun Mar 07 19:38:18 GMT 2004None

ColorChooser

public class ColorChooser extends JFrame

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

        super("Ian Darwin's Color Demo");
        JButton jButton;
		cPane = getContentPane();
        cPane.add(jButton = new JButton("Choose Color..."), BorderLayout.NORTH);
		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(demo = new MyCanvas(300,150), BorderLayout.CENTER);
		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.setBackground(cc.getColor());
				}
			},
			new ActionListener() {
				public void actionPerformed(ActionEvent actionEvent)
				{
					ColorChooser.this.demo.setBackground(getBackground());
				}
			});
	
Methods Summary
public static voidmain(java.lang.String[] astring)

        new ColorChooser().setVisible(true);