Exemplo n.º 1
0
 public void stateChanged(ChangeEvent e) {
   Object obj = e.getSource();
   if (obj instanceof BoundedRangeModel) {
     int id = AdjustmentEvent.ADJUSTMENT_VALUE_CHANGED;
     int type = AdjustmentEvent.TRACK;
     BoundedRangeModel model = (BoundedRangeModel) obj;
     int value = model.getValue();
     boolean isAdjusting = model.getValueIsAdjusting();
     fireAdjustmentValueChanged(id, type, value, isAdjusting);
   }
 }
Exemplo n.º 2
0
  /**
   * Sets the four BoundedRangeModel properties after forcing the arguments to obey the usual
   * constraints:
   *
   * <pre>
   * minimum <= value <= value+extent <= maximum
   * </pre>
   *
   * <p>
   *
   * @see BoundedRangeModel#setRangeProperties
   * @see #setValue
   * @see #setVisibleAmount
   * @see #setMinimum
   * @see #setMaximum
   */
  public void setValues(int newValue, int newExtent, int newMin, int newMax) {
    BoundedRangeModel m = getModel();
    int oldValue = m.getValue();
    m.setRangeProperties(newValue, newExtent, newMin, newMax, m.getValueIsAdjusting());

    if (accessibleContext != null) {
      accessibleContext.firePropertyChange(
          AccessibleContext.ACCESSIBLE_VALUE_PROPERTY,
          Integer.valueOf(oldValue),
          Integer.valueOf(m.getValue()));
    }
  }
Exemplo n.º 3
0
  /**
   * Sets the model's valueIsAdjusting property. Scrollbar look and feel implementations should set
   * this property to true when a knob drag begins, and to false when the drag ends. The scrollbar
   * model will not generate ChangeEvents while valueIsAdjusting is true.
   *
   * @see #getValueIsAdjusting
   * @see BoundedRangeModel#setValueIsAdjusting
   * @beaninfo expert: true description: True if the scrollbar thumb is being dragged.
   */
  public void setValueIsAdjusting(boolean b) {
    BoundedRangeModel m = getModel();
    boolean oldValue = m.getValueIsAdjusting();
    m.setValueIsAdjusting(b);

    if ((oldValue != b) && (accessibleContext != null)) {
      accessibleContext.firePropertyChange(
          AccessibleContext.ACCESSIBLE_STATE_PROPERTY,
          ((oldValue) ? AccessibleState.BUSY : null),
          ((b) ? AccessibleState.BUSY : null));
    }
  }