//
  //  Implement the ChangeListener
  //
  public void stateChanged(ChangeEvent e) {
    //  Keep the scrolling of the row table in sync with main table

    JViewport viewport = (JViewport) e.getSource();
    JScrollPane scrollPane = (JScrollPane) viewport.getParent();
    scrollPane.getVerticalScrollBar().setValue(viewport.getViewPosition().y);
  }
 /** Called when the speed slider was moved. */
 public void SpeedSlider_stateChanged(ChangeEvent e) {
   JSlider source = (JSlider) e.getSource();
   if (!source.getValueIsAdjusting()) {
     int speed = source.getValue();
     notifyControllerListeners(ControllerEvent.SPEED_CHANGE, new Integer(speed));
   }
 }
Exemple #3
0
    public void stateChanged(ChangeEvent e) {
      JSpinner source = (JSpinner) e.getSource();
      if (source.getName().equals("Hour")) {
        calendar.set(Calendar.HOUR_OF_DAY, getSelectedHour());
        return;
      }
      if (source.getName().equals("Year")) {

        calendar.set(Calendar.YEAR, getSelectedYear());
        dayPanel.removeAll();
        this.flushWeekAndDayPanal(calendar);
        dayPanel.revalidate();
        dayPanel.updateUI();
        return;
      }
      if (source.getName().equals("Month")) {
        calendar.set(Calendar.MONTH, getSelectedMonth() - 1);

        dayPanel.removeAll();
        this.flushWeekAndDayPanal(calendar);
        dayPanel.revalidate();
        dayPanel.updateUI();
        return;
      }
    }
Exemple #4
0
 /** Reaction to value changes in the form. */
 public void stateChanged(ChangeEvent e) {
   String nm = ((JComponent) e.getSource()).getName();
   double x;
   if (nm.equals(nmSpinMaxFlow)) {
     x = (Double) spinMaxFlow.getValue();
     mf = x;
   }
   if (nm.equals(nmSpinCapDrop)) {
     x = (Double) spinCapDrop.getValue();
     drp = x;
   }
   if (nm.equals(nmSpinCritDen)) {
     x = (Double) spinCritDen.getValue();
     if (x <= jd) cd = x;
   }
   if (nm.equals(nmSpinJamDen)) {
     x = (Double) spinJamDen.getValue();
     if (x >= cd) jd = x;
   }
   if (nm.equals(nmSpinVff)) {
     x = (Double) spinVff.getValue();
     if (x > 0.0) cd = mf / x;
     double xx = (Double) spinWc.getValue();
     if (xx > 0.0) jd = cd + (mf / xx);
   }
   if (nm.equals(nmSpinWc)) {
     x = (Double) spinWc.getValue();
     if (x > 0.0) jd = cd + (mf / x);
   }
   updateSpinners();
   updateFDSeries();
   return;
 }
 public void stateChanged(ChangeEvent e) {
   JSlider source = (JSlider) e.getSource();
   if (!source.getValueIsAdjusting()) {
     int delay = 1000 * (int) source.getValue();
     LifeSimulation.timer().setDelay(delay);
   }
 }
Exemple #6
0
 public void stateChanged(ChangeEvent e) {
   texta.setText(
       lblName.getText()
           + text0.getText()
           + '\n'
           + lblAge.getText()
           + ((JSpinner) e.getSource()).getValue());
 }
 /** @see javax.swing.event.ChangeListener#stateChanged(javax.swing.event.ChangeEvent) */
 public void stateChanged(ChangeEvent e) {
   // set label according to slider which has been changed
   JSlider source = (JSlider) e.getSource();
   if (source == sliderNumberOfRetries)
     this.currentNumberOfRetries.setText(Integer.toString(source.getValue()));
   if (source == sliderIntervalBetweenRetries)
     this.currentIntervalBetweenRetries.setText(Integer.toString(source.getValue()));
 }
 public void stateChanged(ChangeEvent e) {
   if (e.getSource() == whichRadius) {
     if (!whichRadius.getValueIsAdjusting()) {
       // System.out.println(acc.length);
       if (acc != null) buildAccumulator(whichRadius.getValue());
       accumulator.setSelected(true);
     }
   }
 }
  public void stateChanged(ChangeEvent ce) {
    Object ob = ce.getSource();
    Class<?> cl = ob.getClass();

    if (Debug) {
      System.out.println("MyChangeListener: got stateChanged: Object: " + ob.toString() + "\n");
      System.out.println("MyChangeListener: got stateChanged: Class: " + cl.getName() + "\n");
    }

    if (cl.getName().equals("javax.swing.JTabbedPane")) {
      if (pane == ce.getSource()) {
        int index = pane.getSelectedIndex();
        mLook.stateChanged(index);
      } else {
        System.out.println("The source does NOT equal pane\n");
      }
    }
  }
  public void stateChanged(ChangeEvent e) {
    if (e.getSource() instanceof JSlider && !isAdjusting) {

      int red = redSlider.getValue();
      int green = greenSlider.getValue();
      int blue = blueSlider.getValue();
      Color color = new Color(red, green, blue);

      getColorSelectionModel().setSelectedColor(color);
    } else if (e.getSource() instanceof JSpinner && !isAdjusting) {

      int red = ((Integer) redField.getValue()).intValue();
      int green = ((Integer) greenField.getValue()).intValue();
      int blue = ((Integer) blueField.getValue()).intValue();
      Color color = new Color(red, green, blue);

      getColorSelectionModel().setSelectedColor(color);
    }
  }
  public void stateChanged(ChangeEvent e) {
    JSlider source = (JSlider) e.getSource();

    if (source == unitXSlider) {
      ux = source.getValue();
      graph.setUnityX(ux);
    } else {
      uy = source.getValue();
      graph.setUnityY(uy);
    }
  }
Exemple #12
0
 /** Called when color slider values change. */
 public void stateChanged(ChangeEvent e) {
   JSlider slider = (JSlider) e.getSource();
   int val = slider.getValue();
   String s = "" + val;
   if (val < 100) s = "0" + s;
   if (val < 10) s = "0" + s;
   if (slider == red) redValue.setText(s);
   else if (slider == green) greenValue.setText(s);
   else if (slider == blue) blueValue.setText(s);
   Color c = new Color(red.getValue(), green.getValue(), blue.getValue());
   colorBox.setBackground(c);
 }
 @Override
 public void stateChanged(ChangeEvent event) {
   Object source = event.getSource();
   if (source.equals(gui.getSizeSpinner())) {
     gui.getTestText()
         .setFont(
             new Font(
                 gui.getFontName().getSelectedValue(),
                 Font.PLAIN,
                 (int) gui.getSizeSpinner().getValue()));
   }
 }
 public void stateChanged(ChangeEvent e) {
   // when using these sliders use double buffering, which means
   // ignoring when DemoSurface.imageType = 'On Screen'
   if (getImageType() <= 1) {
     setImageType(2);
   }
   if (e.getSource().equals(slider1)) {
     if (opsIndex == 0) {
       thresholdOp(slider1.getValue(), high);
     } else {
       rescaleFactor = slider1.getValue();
       biop[1] = new RescaleOp((float) rescaleFactor / 128.0f, rescaleOffset, null);
     }
   } else {
     if (opsIndex == 0) {
       thresholdOp(low, slider2.getValue());
     } else {
       rescaleOffset = (float) slider2.getValue();
       biop[1] = new RescaleOp((float) rescaleFactor / 128.0f, rescaleOffset, null);
     }
   }
   repaint();
 }
Exemple #15
0
 public void stateChanged(ChangeEvent e) {
   JSlider sliderResonance = (JSlider) e.getSource();
   int ripple = (int) sliderResonance.getValue();
   filter.setRipple((double) ripple / 2.0d);
 }
Exemple #16
0
 public void stateChanged(ChangeEvent e) {
   JSlider sliderCutoff = (JSlider) e.getSource();
   int cutoff = (int) sliderCutoff.getValue();
   filter.setCutoff((double) cutoff / 4000.0d);
 }
Exemple #17
0
 public void stateChanged(ChangeEvent e) {
   if (((JSlider) e.getSource()).getValueIsAdjusting()) {
     devArray[id].lastSetVal = ((JSlider) e.getSource()).getValue();
   }
 }
Exemple #18
0
 public void stateChanged(final ChangeEvent e) {
   if (e.getSource() == altEditCheckBox) {
     altEditChanged();
   }
 }
 public void stateChanged(ChangeEvent event) {
   if (event.getSource() == slider1) ball1.setDelay(slider1.getValue());
   else ball2.setDelay(slider2.getValue());
 } // end of SliderListener
  /*
   * Name: stateChanged
   * Purpose: Changes speed
   * Parameters: ChangeEvent evt
   * Return: void
   */
  public void stateChanged(ChangeEvent evt) {

    // get the JSlider value
    speed = ((JSlider) (evt.getSource())).getValue();
  }