home *** CD-ROM | disk | FTP | other *** search
/ Symantec Visual Cafe for Java 2.5 / symantec-visual-cafe-2.5-database-dev-edition.iso / VCafe / WDESAMPL.BIN / DitherControls.class (.txt) < prev    next >
Encoding:
Java Class File  |  1997-03-20  |  1.9 KB  |  54 lines

  1. import java.awt.Button;
  2. import java.awt.Choice;
  3. import java.awt.Container;
  4. import java.awt.Event;
  5. import java.awt.FlowLayout;
  6. import java.awt.Label;
  7. import java.awt.LayoutManager;
  8. import java.awt.Panel;
  9. import java.awt.TextField;
  10.  
  11. class DitherControls extends Panel {
  12.    TextField start;
  13.    TextField end;
  14.    Button button;
  15.    Choice choice;
  16.    DitherTest applet;
  17.    static LayoutManager dcLayout = new FlowLayout(1, 10, 5);
  18.  
  19.    public DitherControls(DitherTest var1, int var2, int var3, int var4, boolean var5) {
  20.       this.applet = var1;
  21.       ((Container)this).setLayout(dcLayout);
  22.       ((Container)this).add(new Label(var5 ? "Vertical" : "Horizontal"));
  23.       ((Container)this).add(this.choice = new Choice());
  24.       this.choice.addItem("Noop");
  25.       this.choice.addItem("Red");
  26.       this.choice.addItem("Green");
  27.       this.choice.addItem("Blue");
  28.       this.choice.addItem("Alpha");
  29.       this.choice.addItem("Saturation");
  30.       this.choice.select(var4);
  31.       ((Container)this).add(this.start = new TextField(Integer.toString(var2), 4));
  32.       ((Container)this).add(this.end = new TextField(Integer.toString(var3), 4));
  33.    }
  34.  
  35.    public void addRenderButton() {
  36.       ((Container)this).add(this.button = new Button("New Image"));
  37.    }
  38.  
  39.    public int getParams(int[] var1) {
  40.       var1[0] = Integer.parseInt(this.start.getText());
  41.       var1[1] = Integer.parseInt(this.end.getText());
  42.       return this.choice.getSelectedIndex();
  43.    }
  44.  
  45.    public boolean action(Event var1, Object var2) {
  46.       if (var1.target instanceof Button) {
  47.          this.applet.restart();
  48.          return true;
  49.       } else {
  50.          return false;
  51.       }
  52.    }
  53. }
  54.