コード例 #1
0
ファイル: JScrollBar.java プロジェクト: GregBowyer/Hotspot
 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);
   }
 }
コード例 #2
0
ファイル: JScrollBar.java プロジェクト: GregBowyer/Hotspot
  /**
   * 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()));
    }
  }
コード例 #3
0
ファイル: JScrollBar.java プロジェクト: GregBowyer/Hotspot
  /**
   * 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));
    }
  }
コード例 #4
0
ファイル: JScrollBar.java プロジェクト: GregBowyer/Hotspot
  /**
   * Sets the scrollbar's value. This method just forwards the value to the model.
   *
   * @see #getValue
   * @see BoundedRangeModel#setValue
   * @beaninfo preferred: true description: The scrollbar's current value.
   */
  public void setValue(int value) {
    BoundedRangeModel m = getModel();
    int oldValue = m.getValue();
    m.setValue(value);

    if (accessibleContext != null) {
      accessibleContext.firePropertyChange(
          AccessibleContext.ACCESSIBLE_VALUE_PROPERTY,
          Integer.valueOf(oldValue),
          Integer.valueOf(m.getValue()));
    }
  }
コード例 #5
0
ファイル: JScrollBar.java プロジェクト: GregBowyer/Hotspot
  /**
   * Sets the model that handles the scrollbar's four fundamental properties: minimum, maximum,
   * value, extent.
   *
   * @see #getModel
   * @beaninfo bound: true expert: true description: The scrollbar's BoundedRangeModel.
   */
  public void setModel(BoundedRangeModel newModel) {
    Integer oldValue = null;
    BoundedRangeModel oldModel = model;
    if (model != null) {
      model.removeChangeListener(fwdAdjustmentEvents);
      oldValue = Integer.valueOf(model.getValue());
    }
    model = newModel;
    if (model != null) {
      model.addChangeListener(fwdAdjustmentEvents);
    }

    firePropertyChange("model", oldModel, model);

    if (accessibleContext != null) {
      accessibleContext.firePropertyChange(
          AccessibleContext.ACCESSIBLE_VALUE_PROPERTY, oldValue, new Integer(model.getValue()));
    }
  }
コード例 #6
0
ファイル: JSlider.java プロジェクト: CodeingBoy/Java8CN
  /**
   * Sets the {@code BoundedRangeModel} that handles the slider's three fundamental properties:
   * minimum, maximum, value.
   *
   * <p>Attempts to pass a {@code null} model to this method result in undefined behavior, and, most
   * likely, exceptions.
   *
   * @param newModel the new, {@code non-null} <code>BoundedRangeModel</code> to use
   * @see #getModel
   * @see BoundedRangeModel
   * @beaninfo bound: true description: The sliders BoundedRangeModel.
   */
  public void setModel(BoundedRangeModel newModel) {
    BoundedRangeModel oldModel = getModel();

    if (oldModel != null) {
      oldModel.removeChangeListener(changeListener);
    }

    sliderModel = newModel;

    if (newModel != null) {
      newModel.addChangeListener(changeListener);
    }

    if (accessibleContext != null) {
      accessibleContext.firePropertyChange(
          AccessibleContext.ACCESSIBLE_VALUE_PROPERTY,
          (oldModel == null ? null : Integer.valueOf(oldModel.getValue())),
          (newModel == null ? null : Integer.valueOf(newModel.getValue())));
    }

    firePropertyChange("model", oldModel, sliderModel);
  }
コード例 #7
0
ファイル: JSlider.java プロジェクト: CodeingBoy/Java8CN
 /**
  * Get the maximum accessible value of this object.
  *
  * @return The maximum value of this object.
  */
 public Number getMaximumAccessibleValue() {
   // TIGER - 4422362
   BoundedRangeModel model = JSlider.this.getModel();
   return Integer.valueOf(model.getMaximum() - model.getExtent());
 }