public void paint(Graphics g) {
   int x = s1.getValue();
   int y = s2.getValue();
   int z = s3.getValue();
   Color c = new Color(x, y, z);
   setBackground(c);
 }
Exemple #2
0
 // public void setPoint(T3d p){ point=p; set_values(); }
 private void set_values() {
   x_bar.setValue((int) view.camera.x / 100);
   y_bar.setValue((int) view.camera.y / 100);
   z_bar.setValue((int) view.camera.z / 100);
   x_text.setText("" + (int) view.camera.x / 100);
   y_text.setText("" + (int) view.camera.y / 100);
   z_text.setText("" + (int) view.camera.z / 100);
 }
  public void mouseDragged(MouseEvent me) {

    int x = me.getX();
    int y = me.getY();
    vertSB.setValue(y);
    horzSB.setValue(x);
    repaint();
  }
 public void adjustmentValueChanged(AdjustmentEvent e) {
   Object ob = e.getSource();
   int p, q, r;
   p = s1.getValue();
   q = s2.getValue();
   r = s3.getValue();
   Color c = new Color(p, q, r);
   p1.setBackground(c);
 }
 public void mouseDragged(MouseEvent mme) {
   System.out.println("dragged");
   int x = mme.getX();
   int y = mme.getX();
   int z = mme.getX();
   s1.setValue(x);
   s2.setValue(y);
   s3.setValue(z);
 }
  public void paint(Graphics g) {

    msg = "Vertical: " + vertSB.getValue();
    msg += ", Horizontal: " + horzSB.getValue();
    g.drawString(msg, 6, 160);

    // show current mouse drag position

    g.drawString("*", horzSB.getValue(), vertSB.getValue());
  }
 demo5() {
   f = new Frame();
   f.setSize(300, 300);
   // f.setBackground(Color.red);
   f.setLayout(null);
   s1 = new Scrollbar(Scrollbar.VERTICAL, 0, 5, 0, 260);
   s1.setBackground(Color.red);
   s1.setBounds(30, 35, 20, 255);
   s2 = new Scrollbar(Scrollbar.VERTICAL, 0, 5, 0, 260);
   s2.setBackground(Color.green);
   s2.setBounds(60, 35, 20, 255);
   s3 = new Scrollbar(Scrollbar.VERTICAL, 0, 5, 0, 260);
   s3.setBackground(Color.blue);
   s3.setBounds(90, 35, 20, 255);
   f.add(s1);
   f.add(s2);
   f.add(s3);
   s1.addAdjustmentListener(this);
   s2.addAdjustmentListener(this);
   s3.addAdjustmentListener(this);
   p1 = new Panel();
   p1.setBounds(120, 35, 170, 255);
   f.add(p1);
   f.setVisible(true);
 }
 /** Capture des évènements des scrollbars */
 public void adjustmentValueChanged(AdjustmentEvent e) {
   if (e.getSource().equals(sb_victoires)) {
     int valeur = sb_victoires.getValue();
     lbl_victoires.setText("Nombre De Victoires: " + valeur);
     nb_victoires = valeur;
   } else {
     int valeur = sb_fps.getValue();
     lbl_fps.setText("FPS: " + valeur);
     fps = valeur;
   }
 } // adjustmentValueChanged()
Exemple #9
0
 public synchronized void adjustmentValueChanged(AdjustmentEvent e) {
   Object source = e.getSource();
   for (int i = 0; i < slider.size(); i++) {
     if (source == slider.elementAt(i)) {
       Scrollbar sb = (Scrollbar) source;
       TextField tf = (TextField) numberField.elementAt(sliderIndexes[i]);
       int digits = sliderScales[i] == 1.0 ? 0 : 2;
       tf.setText("" + IJ.d2s(sb.getValue() / sliderScales[i], digits));
     }
   }
 }
  /**
   * Called to set the URL to browse, and reset the scrollbars.
   *
   * @param url indicates document to view.
   * @throws IOException if an error occures
   */
  public void setURL(final URL url) throws IOException {
    final URL old = getURL();
    super.setURL(url);

    if (old == null) {
      // bcr      getImageWait().setBufferMode(DjVuImage.COMPLETE_BUFFER);
      setScrollbar(Scrollbar.HORIZONTAL, new Scrollbar(Scrollbar.HORIZONTAL));
      setScrollbar(Scrollbar.VERTICAL, new Scrollbar(Scrollbar.VERTICAL));
      hScroll.setUnitIncrement(16);
      vScroll.setUnitIncrement(16);
    }
  }
 /**
  * Called to process scrollbar events.
  *
  * @param event to process.
  */
 public void adjustmentValueChanged(AdjustmentEvent event) {
   try {
     final Scrollbar hScroll = getScrollbar(Scrollbar.HORIZONTAL);
     final Scrollbar vScroll = getScrollbar(Scrollbar.VERTICAL);
     final Point scrollPosition = getScrollPosition();
     setScrollPosition(
         (hScroll != null) ? hScroll.getValue() : scrollPosition.x,
         (vScroll != null) ? vScroll.getValue() : scrollPosition.y);
   } catch (final Throwable exp) {
     exp.printStackTrace(DjVuOptions.err);
     System.gc();
   }
 }
Exemple #12
0
 public void adjustmentValueChanged(AdjustmentEvent event) {
   if (event.getSource() == SBrecpos) {
     if (event.getAdjustmentType() == AdjustmentEvent.TRACK) {
       goTo(SBrecpos.getValue());
       return;
     }
     if (event.getID() == AdjustmentEvent.ADJUSTMENT_VALUE_CHANGED) {
       SBrecpos.setEnabled(false);
       goTo(SBrecpos.getValue());
       SBrecpos.setEnabled(true);
     }
   }
 }
 public void init() {
   s1 = new Scrollbar(Scrollbar.HORIZONTAL, 0, 1, 0, 255);
   s2 = new Scrollbar(Scrollbar.HORIZONTAL, 0, 5, 0, 255);
   s3 = new Scrollbar(Scrollbar.HORIZONTAL, 0, 10, 0, 255);
   add(s1);
   add(s2);
   add(s3);
   s1.addAdjustmentListener(this);
   s2.addAdjustmentListener(this);
   s3.addAdjustmentListener(this);
   addMouseMotionListener(this);
   /*	s1.addMouseMotionListener(this);
   s2.addMouseMotionListener(this);
   s3.addMouseMotionListener(this);*/
 }
 void adjustMinHue(int value) {
   minHue = value;
   if (maxHue < minHue) {
     maxHue = minHue;
     maxSlider.setValue((int) maxHue);
   }
 }
Exemple #15
0
  private void updateFromSlider() {
    double v = getValue(scroll.getValue());
    field.setText(ftoa(v));
    val = v;

    value_changed.notify(new Double(val));
  }
 void adjustMinBri(int value) {
   minBri = value;
   if (maxBri < minBri) {
     maxBri = minBri;
     maxSlider3.setValue((int) maxBri);
   }
 }
 void adjustMinSat(int value) {
   minSat = value;
   if (maxSat < minSat) {
     maxSat = minSat;
     maxSlider2.setValue((int) maxSat);
   }
 }
 void adjustMaxSat(int value) {
   maxSat = value;
   if (minSat > maxSat) {
     minSat = maxSat;
     minSlider2.setValue((int) minSat);
   }
 }
Exemple #19
0
  private void updateFromField() {
    try {
      double v = 0.0;

      if (integral) {
        v = (double) (Integer.parseInt(field.getText()));
      } else {
        v = (new Double(field.getText())).doubleValue();
      }

      if (v < min) {
        v = min;
        field.setText(ftoa(v));
      } else if (v > max) {
        v = max;
        field.setText(ftoa(v));
      }

      scroll.setValue(getSlideLoc(v));
      val = v;
      value_changed.notify(new Double(v));
    } catch (NumberFormatException nfe) {
      field.setText(ftoa(val));
    }
  }
 void adjustMaxBri(int value) {
   maxBri = value;
   if (minBri > maxBri) {
     minBri = maxBri;
     minSlider3.setValue((int) minBri);
   }
 }
Exemple #21
0
  public Slider(String name, double init, double min, double max) {
    this.val = init;
    this.min = min;
    this.max = max;

    this.integral = false;

    this.name = new Label(name);
    this.field = new TextField(ftoa(init), 7);
    this.scroll = new Scrollbar(Scrollbar.HORIZONTAL, getSlideLoc(init), 1, 0, 257);

    this.value_changed = new Signal();

    scroll.addAdjustmentListener(
        new AdjustmentListener() {
          public void adjustmentValueChanged(AdjustmentEvent ae) {
            updateFromSlider();
          }
        });

    field.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent ae) {
            updateFromField();
          }
        });
  }
 void adjustMaxHue(int value) {
   maxHue = value;
   if (minHue > maxHue) {
     minHue = maxHue;
     minSlider.setValue((int) minHue);
   }
 }
Exemple #23
0
 public void textValueChanged(TextEvent e) {
   notifyListeners(e);
   if (slider == null) return;
   Object source = e.getSource();
   for (int i = 0; i < slider.size(); i++) {
     int index = sliderIndexes[i];
     if (source == numberField.elementAt(index)) {
       TextField tf = (TextField) numberField.elementAt(index);
       double value = Tools.parseDouble(tf.getText());
       if (!Double.isNaN(value)) {
         Scrollbar sb = (Scrollbar) slider.elementAt(i);
         sb.setValue((int) (value * sliderScales[i]));
       }
       // IJ.log(i+" "+tf.getText());
     }
   }
 }
  public void init() {

    int width = Integer.parseInt(getParameter("width"));
    int height = Integer.parseInt(getParameter("height"));
    vertSB = new Scrollbar(Scrollbar.VERTICAL, 0, 1, 0, height);

    horzSB = new Scrollbar(Scrollbar.HORIZONTAL, 0, 1, 0, width);

    add(vertSB);
    add(horzSB);

    // register to receive adjustment events

    vertSB.addAdjustmentListener(this);
    horzSB.addAdjustmentListener(this);
    addMouseMotionListener(this);
  }
  // Called to update the scrollbar properties.
  private void updateScrollbars() {
    final DjVuImage image = getImage();
    if (image != null) {
      final Dimension viewportSize = getViewportSize();
      final Dimension imageSize = image.getSize();
      final Point scrollPosition = getScrollPosition();
      final Scrollbar hScroll = getScrollbar(Scrollbar.HORIZONTAL);
      final Scrollbar vScroll = getScrollbar(Scrollbar.VERTICAL);

      if (hScroll != null) {
        hScroll.setValues(scrollPosition.x, viewportSize.width, 0, imageSize.width);
      }

      if (vScroll != null) {
        vScroll.setValues(scrollPosition.y, viewportSize.height, 0, imageSize.height);
      }
    }
  }
  /**
   * Set either the horizontal or vertical scrollbar.
   *
   * @param orientation either Scrollbar.HORIZONTAL or Scrollbar.VERTICAL
   * @param scrollbar component.
   */
  public void setScrollbar(int orientation, Scrollbar scrollbar) {
    if (orientation == Scrollbar.HORIZONTAL) {
      hScroll = scrollbar;
    } else {
      vScroll = scrollbar;
    }

    scrollbar.addAdjustmentListener(this);
    updateScrollbars();
  }
    public synchronized void adjustmentValueChanged(AdjustmentEvent e) {

      if (!checkImage()) {
        IJ.beep();
        IJ.showStatus("No Image");
        return;
      }

      if (e.getSource() == minSlider) {
        adjustMinHue((int) minSlider.getValue());
      } else if (e.getSource() == maxSlider) {
        adjustMaxHue((int) maxSlider.getValue());
      } else if (e.getSource() == minSlider2) {
        adjustMinSat((int) minSlider2.getValue());
      } else if (e.getSource() == maxSlider2) {
        adjustMaxSat((int) maxSlider2.getValue());
      } else if (e.getSource() == minSlider3) {
        adjustMinBri((int) minSlider3.getValue());
      } else if (e.getSource() == maxSlider3) {
        adjustMaxBri((int) maxSlider3.getValue());
      }
      originalB.setEnabled(true);
      updateLabels();
      updatePlot();
      notify();
    }
 void updateScrollBars() {
   minSlider.setValue((int) minHue);
   maxSlider.setValue((int) maxHue);
   minSlider2.setValue((int) minSat);
   maxSlider2.setValue((int) maxSat);
   minSlider3.setValue((int) minBri);
   maxSlider3.setValue((int) maxBri);
 }
Exemple #29
0
  public void setValue(double v, boolean propagate) {
    if (v < min) {
      v = min;
    } else if (v > max) {
      v = max;
    }

    scroll.setValue(getSlideLoc(v));
    field.setText(ftoa(v));
    val = v;

    if (propagate) {
      value_changed.notify(new Double(v));
    }
  }
Exemple #30
0
  public void goTo(int where) {
    try {
      if (where < 1) {
        return;
      }
      if (where > db.getRecordCount()) {
        return;
      }
      db.gotoRecord(where);
      crl.setText("Record " + db.getCurrentRecordNumber());
      delCB.setState(db.deleted());

      Field f;
      LogicalField lf;
      Checkbox c;
      TextField t;

      int i;

      for (i = 1; i <= db.getFieldCount(); i++) {
        f = db.getField(i);
        if (f.isMemoField()) {
        } else if (f.getType() == 'L') {
          lf = (LogicalField) f;
          c = (Checkbox) fldObjects.elementAt(i - 1);
          c.setState(lf.getBoolean());
        } else {
          t = (TextField) fldObjects.elementAt(i - 1);
          t.setText(f.get().trim());
        }
      }

      Next.setEnabled(!(db.getCurrentRecordNumber() == db.getRecordCount()));
      nextRecord.setEnabled(!(db.getCurrentRecordNumber() == db.getRecordCount()));

      Prev.setEnabled(!(db.getCurrentRecordNumber() == 1));
      prevRecord.setEnabled(!(db.getCurrentRecordNumber() == 1));

      firstRecord.setEnabled(db.getRecordCount() > 0);
      lastRecord.setEnabled(db.getRecordCount() > 0);

      SBrecpos.setValues(db.getCurrentRecordNumber(), 1, 0, db.getRecordCount());
    } // try
    catch (Exception e1) {
      System.out.println(e1);
      System.exit(2);
    }
  }