Java Code Examples for java.awt.event.AdjustmentEvent#ADJUSTMENT_VALUE_CHANGED

The following examples show how to use java.awt.event.AdjustmentEvent#ADJUSTMENT_VALUE_CHANGED . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ScrollPaneAdjustable.java    From Java8CN with Apache License 2.0 6 votes vote down vote up
/**
 * Sets the value of this scrollbar to the specified value.
 * <p>
 * If the value supplied is less than the current minimum or
 * greater than the current maximum, then one of those values is
 * substituted, as appropriate. Also, creates and dispatches
 * the AdjustementEvent with specified type and value.
 *
 * @param v the new value of the scrollbar
 * @param type the type of the scrolling operation occurred
 */
private void setTypedValue(int v, int type) {
    v = Math.max(v, minimum);
    v = Math.min(v, maximum - visibleAmount);

    if (v != value) {
        value = v;
        // Synchronously notify the listeners so that they are
        // guaranteed to be up-to-date with the Adjustable before
        // it is mutated again.
        AdjustmentEvent e =
            new AdjustmentEvent(this,
                    AdjustmentEvent.ADJUSTMENT_VALUE_CHANGED,
                    type, value, isAdjusting);
        adjustmentListener.adjustmentValueChanged(e);
    }
}
 
Example 2
Source File: ScrollPaneAdjustable.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Sets the value of this scrollbar to the specified value.
 * <p>
 * If the value supplied is less than the current minimum or
 * greater than the current maximum, then one of those values is
 * substituted, as appropriate. Also, creates and dispatches
 * the AdjustementEvent with specified type and value.
 *
 * @param v the new value of the scrollbar
 * @param type the type of the scrolling operation occurred
 */
private void setTypedValue(int v, int type) {
    v = Math.max(v, minimum);
    v = Math.min(v, maximum - visibleAmount);

    if (v != value) {
        value = v;
        // Synchronously notify the listeners so that they are
        // guaranteed to be up-to-date with the Adjustable before
        // it is mutated again.
        AdjustmentEvent e =
            new AdjustmentEvent(this,
                    AdjustmentEvent.ADJUSTMENT_VALUE_CHANGED,
                    type, value, isAdjusting);
        adjustmentListener.adjustmentValueChanged(e);
    }
}
 
Example 3
Source File: ScrollPaneAdjustable.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Sets the value of this scrollbar to the specified value.
 * <p>
 * If the value supplied is less than the current minimum or
 * greater than the current maximum, then one of those values is
 * substituted, as appropriate. Also, creates and dispatches
 * the AdjustementEvent with specified type and value.
 *
 * @param v the new value of the scrollbar
 * @param type the type of the scrolling operation occurred
 */
private void setTypedValue(int v, int type) {
    v = Math.max(v, minimum);
    v = Math.min(v, maximum - visibleAmount);

    if (v != value) {
        value = v;
        // Synchronously notify the listeners so that they are
        // guaranteed to be up-to-date with the Adjustable before
        // it is mutated again.
        AdjustmentEvent e =
            new AdjustmentEvent(this,
                    AdjustmentEvent.ADJUSTMENT_VALUE_CHANGED,
                    type, value, isAdjusting);
        adjustmentListener.adjustmentValueChanged(e);
    }
}
 
Example 4
Source File: ScrollPaneAdjustable.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Sets the value of this scrollbar to the specified value.
 * <p>
 * If the value supplied is less than the current minimum or
 * greater than the current maximum, then one of those values is
 * substituted, as appropriate. Also, creates and dispatches
 * the AdjustementEvent with specified type and value.
 *
 * @param v the new value of the scrollbar
 * @param type the type of the scrolling operation occurred
 */
private void setTypedValue(int v, int type) {
    v = Math.max(v, minimum);
    v = Math.min(v, maximum - visibleAmount);

    if (v != value) {
        value = v;
        // Synchronously notify the listeners so that they are
        // guaranteed to be up-to-date with the Adjustable before
        // it is mutated again.
        AdjustmentEvent e =
            new AdjustmentEvent(this,
                    AdjustmentEvent.ADJUSTMENT_VALUE_CHANGED,
                    type, value, isAdjusting);
        adjustmentListener.adjustmentValueChanged(e);
    }
}
 
Example 5
Source File: ScrollPaneAdjustable.java    From jdk-1.7-annotated with Apache License 2.0 6 votes vote down vote up
/**
 * Sets the value of this scrollbar to the specified value.
 * <p>
 * If the value supplied is less than the current minimum or
 * greater than the current maximum, then one of those values is
 * substituted, as appropriate. Also, creates and dispatches
 * the AdjustementEvent with specified type and value.
 *
 * @param v the new value of the scrollbar
 * @param type the type of the scrolling operation occured
 */
private void setTypedValue(int v, int type) {
    v = Math.max(v, minimum);
    v = Math.min(v, maximum - visibleAmount);

    if (v != value) {
        value = v;
        // Synchronously notify the listeners so that they are
        // guaranteed to be up-to-date with the Adjustable before
        // it is mutated again.
        AdjustmentEvent e =
            new AdjustmentEvent(this,
                    AdjustmentEvent.ADJUSTMENT_VALUE_CHANGED,
                    type, value, isAdjusting);
        adjustmentListener.adjustmentValueChanged(e);
    }
}
 
Example 6
Source File: JScrollBar.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
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);
    }
}
 
Example 7
Source File: ScrollPaneAdjustable.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Sets the <code>valueIsAdjusting</code> property.
 *
 * @param b new adjustment-in-progress status
 * @see #getValueIsAdjusting
 * @since 1.4
 */
public void setValueIsAdjusting(boolean b) {
    if (isAdjusting != b) {
        isAdjusting = b;
        AdjustmentEvent e =
            new AdjustmentEvent(this,
                    AdjustmentEvent.ADJUSTMENT_VALUE_CHANGED,
                    AdjustmentEvent.TRACK, value, b);
        adjustmentListener.adjustmentValueChanged(e);
    }
}
 
Example 8
Source File: ScrollPaneAdjustable.java    From Bytecoder with Apache License 2.0 5 votes vote down vote up
/**
 * Sets the {@code valueIsAdjusting} property.
 *
 * @param b new adjustment-in-progress status
 * @see #getValueIsAdjusting
 * @since 1.4
 */
public void setValueIsAdjusting(boolean b) {
    if (isAdjusting != b) {
        isAdjusting = b;
        AdjustmentEvent e =
            new AdjustmentEvent(this,
                    AdjustmentEvent.ADJUSTMENT_VALUE_CHANGED,
                    AdjustmentEvent.TRACK, value, b);
        adjustmentListener.adjustmentValueChanged(e);
    }
}
 
Example 9
Source File: ScrollPaneAdjustable.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Sets the <code>valueIsAdjusting</code> property.
 *
 * @param b new adjustment-in-progress status
 * @see #getValueIsAdjusting
 * @since 1.4
 */
public void setValueIsAdjusting(boolean b) {
    if (isAdjusting != b) {
        isAdjusting = b;
        AdjustmentEvent e =
            new AdjustmentEvent(this,
                    AdjustmentEvent.ADJUSTMENT_VALUE_CHANGED,
                    AdjustmentEvent.TRACK, value, b);
        adjustmentListener.adjustmentValueChanged(e);
    }
}
 
Example 10
Source File: ScrollPaneAdjustable.java    From jdk8u-dev-jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Sets the <code>valueIsAdjusting</code> property.
 *
 * @param b new adjustment-in-progress status
 * @see #getValueIsAdjusting
 * @since 1.4
 */
public void setValueIsAdjusting(boolean b) {
    if (isAdjusting != b) {
        isAdjusting = b;
        AdjustmentEvent e =
            new AdjustmentEvent(this,
                    AdjustmentEvent.ADJUSTMENT_VALUE_CHANGED,
                    AdjustmentEvent.TRACK, value, b);
        adjustmentListener.adjustmentValueChanged(e);
    }
}
 
Example 11
Source File: AWTEvent.java    From Bytecoder with Apache License 2.0 5 votes vote down vote up
/**
 * Constructs an AWTEvent object with the specified source object and type.
 *
 * @param source the object where the event originated
 * @param id the event type
 */
public AWTEvent(Object source, int id) {
    super(source);
    this.id = id;
    switch(id) {
      case ActionEvent.ACTION_PERFORMED:
      case ItemEvent.ITEM_STATE_CHANGED:
      case AdjustmentEvent.ADJUSTMENT_VALUE_CHANGED:
      case TextEvent.TEXT_VALUE_CHANGED:
        consumed = true;
        break;
      default:
    }
}
 
Example 12
Source File: ScrollPaneAdjustable.java    From JDKSourceCode1.8 with MIT License 5 votes vote down vote up
/**
 * Sets the <code>valueIsAdjusting</code> property.
 *
 * @param b new adjustment-in-progress status
 * @see #getValueIsAdjusting
 * @since 1.4
 */
public void setValueIsAdjusting(boolean b) {
    if (isAdjusting != b) {
        isAdjusting = b;
        AdjustmentEvent e =
            new AdjustmentEvent(this,
                    AdjustmentEvent.ADJUSTMENT_VALUE_CHANGED,
                    AdjustmentEvent.TRACK, value, b);
        adjustmentListener.adjustmentValueChanged(e);
    }
}
 
Example 13
Source File: JScrollBar.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
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);
    }
}
 
Example 14
Source File: ScrollPaneAdjustable.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Sets the <code>valueIsAdjusting</code> property.
 *
 * @param b new adjustment-in-progress status
 * @see #getValueIsAdjusting
 * @since 1.4
 */
public void setValueIsAdjusting(boolean b) {
    if (isAdjusting != b) {
        isAdjusting = b;
        AdjustmentEvent e =
            new AdjustmentEvent(this,
                    AdjustmentEvent.ADJUSTMENT_VALUE_CHANGED,
                    AdjustmentEvent.TRACK, value, b);
        adjustmentListener.adjustmentValueChanged(e);
    }
}
 
Example 15
Source File: ScrollPaneAdjustable.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Sets the <code>valueIsAdjusting</code> property.
 *
 * @param b new adjustment-in-progress status
 * @see #getValueIsAdjusting
 * @since 1.4
 */
public void setValueIsAdjusting(boolean b) {
    if (isAdjusting != b) {
        isAdjusting = b;
        AdjustmentEvent e =
            new AdjustmentEvent(this,
                    AdjustmentEvent.ADJUSTMENT_VALUE_CHANGED,
                    AdjustmentEvent.TRACK, value, b);
        adjustmentListener.adjustmentValueChanged(e);
    }
}
 
Example 16
Source File: ScrollPaneAdjustable.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Sets the <code>valueIsAdjusting</code> property.
 *
 * @param b new adjustment-in-progress status
 * @see #getValueIsAdjusting
 * @since 1.4
 */
public void setValueIsAdjusting(boolean b) {
    if (isAdjusting != b) {
        isAdjusting = b;
        AdjustmentEvent e =
            new AdjustmentEvent(this,
                    AdjustmentEvent.ADJUSTMENT_VALUE_CHANGED,
                    AdjustmentEvent.TRACK, value, b);
        adjustmentListener.adjustmentValueChanged(e);
    }
}
 
Example 17
Source File: JScrollBar.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
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);
    }
}
 
Example 18
Source File: ScrollPaneAdjustable.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Sets the <code>valueIsAdjusting</code> property.
 *
 * @param b new adjustment-in-progress status
 * @see #getValueIsAdjusting
 * @since 1.4
 */
public void setValueIsAdjusting(boolean b) {
    if (isAdjusting != b) {
        isAdjusting = b;
        AdjustmentEvent e =
            new AdjustmentEvent(this,
                    AdjustmentEvent.ADJUSTMENT_VALUE_CHANGED,
                    AdjustmentEvent.TRACK, value, b);
        adjustmentListener.adjustmentValueChanged(e);
    }
}
 
Example 19
Source File: JScrollBar.java    From jdk1.8-source-analysis with Apache License 2.0 5 votes vote down vote up
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);
    }
}
 
Example 20
Source File: JScrollBar.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
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);
    }
}