コード例 #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));
    }
  }