home *** CD-ROM | disk | FTP | other *** search
- import java.awt.Color;
- import java.awt.Container;
- import java.awt.Dimension;
- import java.awt.GridLayout;
- import java.awt.Panel;
-
- class ColorChooser extends Panel {
- private ColorPreview preview;
- private RGBChooser red;
- private RGBChooser green;
- private RGBChooser blue;
-
- public ColorChooser(ColorPreview var1, Color var2) {
- this.preview = var1;
- ((Container)this).setLayout(new GridLayout(3, 1));
- this.red = new RGBChooser(this, " Red", var2.getRed());
- this.red.colorScroll.setBackground(Color.red);
- ((Container)this).add(this.red);
- this.green = new RGBChooser(this, "Green", var2.getGreen());
- this.green.colorScroll.setBackground(Color.green);
- ((Container)this).add(this.green);
- this.blue = new RGBChooser(this, " Blue", var2.getBlue());
- this.blue.colorScroll.setBackground(Color.blue);
- ((Container)this).add(this.blue);
- this.colorChange();
- }
-
- public Dimension minimumSize() {
- return new Dimension(120, 60);
- }
-
- public Dimension preferredSize() {
- return new Dimension(240, 120);
- }
-
- public void colorChange() {
- this.preview.setColor(this.getColor());
- }
-
- public Color getColor() {
- return new Color(this.red.getValue(), this.green.getValue(), this.blue.getValue());
- }
- }
-