Exemplo n.º 1
0
 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);
 }
Exemplo n.º 2
0
 public void setSBBounds() {
   int graczy = DB.getCompetitors(turniej.getId()).size();
   groupsSB.setMinimum(2);
   groupsSB.setMaximum((int) Math.ceil(graczy / 2) + 2);
   groupsSB.setValue(turniej.getRounds());
   recalcStats();
 }
Exemplo n.º 3
0
  public TMapMainWindow(Frame parent) {
    //    Задаем менеджер размещения типа BorderLayout
    //    (ориентация распологаемых объектов на панели
    //    относительно рамки)
    setLayout(new BorderLayout());

    //    Создаем экземпляр объекта класса TDocWindow
    //    размещаем его в центре

    DocWindow = new TDocWindow(parent);
    DocWindow.init();
    DocWindow.start();
    DocWindow.setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
    add("Center", DocWindow);
    DocWindow.ObjectDialog.MainWindow = (TMapMainWindowBase) this; // 15/12/04

    //  Проектируем горизонтальный и вертикальный скроллинг
    ScrollBar1 = new Scrollbar(Scrollbar.HORIZONTAL);
    ScrollBar1.setUnitIncrement(10);
    ScrollBar1.setBlockIncrement(100);
    ScrollBar1.setValues(0, 0, 0, 0);
    add("South", ScrollBar1);
    ScrollBar1.setEnabled(false);
    ScrollBar2 = new Scrollbar(Scrollbar.VERTICAL);
    ScrollBar2.setUnitIncrement(10);
    ScrollBar2.setBlockIncrement(100);
    ScrollBar2.setValues(0, 0, 0, 0);
    add("East", ScrollBar2);
    ScrollBar2.setEnabled(false);
    ScrollBar1.setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
    ScrollBar2.setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
  }
  public void mouseDragged(MouseEvent me) {

    int x = me.getX();
    int y = me.getY();
    vertSB.setValue(y);
    horzSB.setValue(x);
    repaint();
  }
Exemplo n.º 5
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);
 }
Exemplo n.º 6
0
 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);
 }
Exemplo n.º 7
0
 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());
  }
Exemplo n.º 9
0
 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);
 }
Exemplo n.º 10
0
 /** 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()
Exemplo n.º 11
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));
     }
   }
 }
Exemplo n.º 12
0
 public void SetScrollBarsValues(int[] left, int[] top) // 15/12/04
     {
   int maxsize = ScrollBar1.getMaximum();
   if (left[0] < 0) left[0] = 0;
   else if (left[0] > maxsize) left[0] = maxsize;
   ScrollBar1.setValues(left[0], 30, 0, maxsize);
   maxsize = ScrollBar2.getMaximum();
   if (top[0] < 0) top[0] = 0;
   else if (top[0] > maxsize) top[0] = maxsize;
   ScrollBar2.setValues(top[0], 30, 0, maxsize);
 }
Exemplo n.º 13
0
  /**
   * 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);
    }
  }
Exemplo n.º 14
0
 public void recalcStats() { // TODO - poprawić przewidywany czas turnieju
   groupsL.setText(Strings.groupsT + groupsSB.getValue());
   boardsL.setText(Strings.boardsT + boardsSB.getValue());
   sgTimeL.setText(Strings.sgTimeT + (sgTimeSB.getValue() / 2f) + " min");
   int graczy = DB.getCompetitors(turniej.getId()).size();
   if (turniej.getBoards() < 1 || graczy < 2) return;
   float czasSG = sgTimeSB.getValue() / 2f;
   int grup = groupsSB.getValue();
   int rozgrywek = Simulator.rozgrywek_eliminacje(graczy, grup);
   stats1L.setText(Strings.gamesT + String.valueOf(rozgrywek));
   int gier_naraz = (int) Math.min(Math.floor(graczy / 2), turniej.getBoards());
   stats2L.setText(Strings.timeRRET + Math.ceil(rozgrywek / gier_naraz) * czasSG + " min");
 }
Exemplo n.º 15
0
 /**
  * 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();
   }
 }
Exemplo n.º 16
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);
     }
   }
 }
Exemplo n.º 17
0
  public void adjustmentValueChanged(AdjustmentEvent evt) {
    // chamado quando o usu�rio modifica o valor de uma das
    // barras de rolagem

    int r = redScroll.getValue();
    int g = greenScroll.getValue();
    int b = blueScroll.getValue();
    redLabel.setText(" R = " + r);
    greenLabel.setText(" G = " + g);
    blueLabel.setText(" B = " + b);
    colorCanvas.setBackground(new Color(r, g, b));
    colorCanvas.repaint();
    // Redraw the canvas in its new color.

  } // end adjustmentValueChanged
Exemplo n.º 18
0
 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);*/
 }
Exemplo n.º 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));
    }
  }
Exemplo n.º 20
0
  private void updateFromSlider() {
    double v = getValue(scroll.getValue());
    field.setText(ftoa(v));
    val = v;

    value_changed.notify(new Double(val));
  }
Exemplo n.º 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();
          }
        });
  }
Exemplo n.º 22
0
 void adjustMinBri(int value) {
   minBri = value;
   if (maxBri < minBri) {
     maxBri = minBri;
     maxSlider3.setValue((int) maxBri);
   }
 }
Exemplo n.º 23
0
 void adjustMaxHue(int value) {
   maxHue = value;
   if (minHue > maxHue) {
     minHue = maxHue;
     minSlider.setValue((int) minHue);
   }
 }
Exemplo n.º 24
0
 void adjustMaxBri(int value) {
   maxBri = value;
   if (minBri > maxBri) {
     minBri = maxBri;
     minSlider3.setValue((int) minBri);
   }
 }
Exemplo n.º 25
0
 void adjustMaxSat(int value) {
   maxSat = value;
   if (minSat > maxSat) {
     minSat = maxSat;
     minSlider2.setValue((int) minSat);
   }
 }
Exemplo n.º 26
0
  public CollageList() {
    super();

    actionComponent = new Button();

    Panel toolBar;

    setLayout(new BorderLayout());
    //		ggHScroll	= new Scrollbar( Scrollbar.HORIZONTAL, 0, 0x8000, 0, 0x8000 );
    ggVScroll = new Scrollbar(Scrollbar.VERTICAL, 0, 0x8000, 0, 0x8000);
    //		ggHScroll.addAdjustmentListener( ggCurve );
    ggVScroll.addAdjustmentListener(this);

    toolBar = new Panel();
    toolBar.setLayout(new FlowLayout(FlowLayout.LEFT, 2, 2));
    ggAdd = new JButton("    Add    ");
    ggDel = new JButton("  Delete  ");
    ggDup = new JButton(" Duplicate ");
    ggAdd.addActionListener(this);
    ggDel.addActionListener(this);
    ggDup.addActionListener(this);
    toolBar.add(ggAdd);
    toolBar.add(ggDel);
    toolBar.add(ggDup);

    add(toolBar, BorderLayout.NORTH);
    //		add( ggHScroll, BorderLayout.SOUTH );
    add(ggVScroll, BorderLayout.EAST);
    add(new CollageCanvas(this), BorderLayout.CENTER);
    //		add( ggCurve,   BorderLayout.CENTER );
  }
Exemplo n.º 27
0
 void adjustMinSat(int value) {
   minSat = value;
   if (maxSat < minSat) {
     maxSat = minSat;
     maxSlider2.setValue((int) maxSat);
   }
 }
Exemplo n.º 28
0
 void adjustMinHue(int value) {
   minHue = value;
   if (maxHue < minHue) {
     maxHue = minHue;
     maxSlider.setValue((int) maxHue);
   }
 }
Exemplo n.º 29
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());
     }
   }
 }
Exemplo n.º 30
0
  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);
  }