Java Code Examples for java.awt.peer.ScrollbarPeer#setValues()

The following examples show how to use java.awt.peer.ScrollbarPeer#setValues() . 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: Scrollbar.java    From jdk8u-jdk with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Sets the values of four properties for this scroll bar:
 * <code>value</code>, <code>visibleAmount</code>,
 * <code>minimum</code>, and <code>maximum</code>.
 * If the values supplied for these properties are inconsistent
 * or incorrect, they will be changed to ensure consistency.
 * <p>
 * This method simultaneously and synchronously sets the values
 * of four scroll bar properties, assuring that the values of
 * these properties are mutually consistent. It enforces the
 * following constraints:
 * <code>maximum</code> must be greater than <code>minimum</code>,
 * <code>maximum - minimum</code> must not be greater
 *     than <code>Integer.MAX_VALUE</code>,
 * <code>visibleAmount</code> must be greater than zero.
 * <code>visibleAmount</code> must not be greater than
 *     <code>maximum - minimum</code>,
 * <code>value</code> must not be less than <code>minimum</code>,
 * and <code>value</code> must not be greater than
 *     <code>maximum - visibleAmount</code>
 * <p>
 * Calling this method does not fire an
 * <code>AdjustmentEvent</code>.
 *
 * @param      value is the position in the current window
 * @param      visible is the visible amount of the scroll bar
 * @param      minimum is the minimum value of the scroll bar
 * @param      maximum is the maximum value of the scroll bar
 * @see        #setMinimum
 * @see        #setMaximum
 * @see        #setVisibleAmount
 * @see        #setValue
 */
public void setValues(int value, int visible, int minimum, int maximum) {
    int oldValue;
    synchronized (this) {
        if (minimum == Integer.MAX_VALUE) {
            minimum = Integer.MAX_VALUE - 1;
        }
        if (maximum <= minimum) {
            maximum = minimum + 1;
        }

        long maxMinusMin = (long) maximum - (long) minimum;
        if (maxMinusMin > Integer.MAX_VALUE) {
            maxMinusMin = Integer.MAX_VALUE;
            maximum = minimum + (int) maxMinusMin;
        }
        if (visible > (int) maxMinusMin) {
            visible = (int) maxMinusMin;
        }
        if (visible < 1) {
            visible = 1;
        }

        if (value < minimum) {
            value = minimum;
        }
        if (value > maximum - visible) {
            value = maximum - visible;
        }

        oldValue = this.value;
        this.value = value;
        this.visibleAmount = visible;
        this.minimum = minimum;
        this.maximum = maximum;
        ScrollbarPeer peer = (ScrollbarPeer)this.peer;
        if (peer != null) {
            peer.setValues(value, visibleAmount, minimum, maximum);
        }
    }

    if ((oldValue != value) && (accessibleContext != null))  {
        accessibleContext.firePropertyChange(
                AccessibleContext.ACCESSIBLE_VALUE_PROPERTY,
                Integer.valueOf(oldValue),
                Integer.valueOf(value));
    }
}
 
Example 2
Source File: Scrollbar.java    From jdk8u-dev-jdk with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Sets the values of four properties for this scroll bar:
 * <code>value</code>, <code>visibleAmount</code>,
 * <code>minimum</code>, and <code>maximum</code>.
 * If the values supplied for these properties are inconsistent
 * or incorrect, they will be changed to ensure consistency.
 * <p>
 * This method simultaneously and synchronously sets the values
 * of four scroll bar properties, assuring that the values of
 * these properties are mutually consistent. It enforces the
 * following constraints:
 * <code>maximum</code> must be greater than <code>minimum</code>,
 * <code>maximum - minimum</code> must not be greater
 *     than <code>Integer.MAX_VALUE</code>,
 * <code>visibleAmount</code> must be greater than zero.
 * <code>visibleAmount</code> must not be greater than
 *     <code>maximum - minimum</code>,
 * <code>value</code> must not be less than <code>minimum</code>,
 * and <code>value</code> must not be greater than
 *     <code>maximum - visibleAmount</code>
 * <p>
 * Calling this method does not fire an
 * <code>AdjustmentEvent</code>.
 *
 * @param      value is the position in the current window
 * @param      visible is the visible amount of the scroll bar
 * @param      minimum is the minimum value of the scroll bar
 * @param      maximum is the maximum value of the scroll bar
 * @see        #setMinimum
 * @see        #setMaximum
 * @see        #setVisibleAmount
 * @see        #setValue
 */
public void setValues(int value, int visible, int minimum, int maximum) {
    int oldValue;
    synchronized (this) {
        if (minimum == Integer.MAX_VALUE) {
            minimum = Integer.MAX_VALUE - 1;
        }
        if (maximum <= minimum) {
            maximum = minimum + 1;
        }

        long maxMinusMin = (long) maximum - (long) minimum;
        if (maxMinusMin > Integer.MAX_VALUE) {
            maxMinusMin = Integer.MAX_VALUE;
            maximum = minimum + (int) maxMinusMin;
        }
        if (visible > (int) maxMinusMin) {
            visible = (int) maxMinusMin;
        }
        if (visible < 1) {
            visible = 1;
        }

        if (value < minimum) {
            value = minimum;
        }
        if (value > maximum - visible) {
            value = maximum - visible;
        }

        oldValue = this.value;
        this.value = value;
        this.visibleAmount = visible;
        this.minimum = minimum;
        this.maximum = maximum;
        ScrollbarPeer peer = (ScrollbarPeer)this.peer;
        if (peer != null) {
            peer.setValues(value, visibleAmount, minimum, maximum);
        }
    }

    if ((oldValue != value) && (accessibleContext != null))  {
        accessibleContext.firePropertyChange(
                AccessibleContext.ACCESSIBLE_VALUE_PROPERTY,
                Integer.valueOf(oldValue),
                Integer.valueOf(value));
    }
}
 
Example 3
Source File: Scrollbar.java    From jdk-1.7-annotated with Apache License 2.0 4 votes vote down vote up
/**
 * Sets the values of four properties for this scroll bar:
 * <code>value</code>, <code>visibleAmount</code>,
 * <code>minimum</code>, and <code>maximum</code>.
 * If the values supplied for these properties are inconsistent
 * or incorrect, they will be changed to ensure consistency.
 * <p>
 * This method simultaneously and synchronously sets the values
 * of four scroll bar properties, assuring that the values of
 * these properties are mutually consistent. It enforces the
 * following constraints:
 * <code>maximum</code> must be greater than <code>minimum</code>,
 * <code>maximum - minimum</code> must not be greater
 *     than <code>Integer.MAX_VALUE</code>,
 * <code>visibleAmount</code> must be greater than zero.
 * <code>visibleAmount</code> must not be greater than
 *     <code>maximum - minimum</code>,
 * <code>value</code> must not be less than <code>minimum</code>,
 * and <code>value</code> must not be greater than
 *     <code>maximum - visibleAmount</code>
 * <p>
 * Calling this method does not fire an
 * <code>AdjustmentEvent</code>.
 *
 * @param      value is the position in the current window
 * @param      visible is the visible amount of the scroll bar
 * @param      minimum is the minimum value of the scroll bar
 * @param      maximum is the maximum value of the scroll bar
 * @see        #setMinimum
 * @see        #setMaximum
 * @see        #setVisibleAmount
 * @see        #setValue
 */
public void setValues(int value, int visible, int minimum, int maximum) {
    int oldValue;
    synchronized (this) {
        if (minimum == Integer.MAX_VALUE) {
            minimum = Integer.MAX_VALUE - 1;
        }
        if (maximum <= minimum) {
            maximum = minimum + 1;
        }

        long maxMinusMin = (long) maximum - (long) minimum;
        if (maxMinusMin > Integer.MAX_VALUE) {
            maxMinusMin = Integer.MAX_VALUE;
            maximum = minimum + (int) maxMinusMin;
        }
        if (visible > (int) maxMinusMin) {
            visible = (int) maxMinusMin;
        }
        if (visible < 1) {
            visible = 1;
        }

        if (value < minimum) {
            value = minimum;
        }
        if (value > maximum - visible) {
            value = maximum - visible;
        }

        oldValue = this.value;
        this.value = value;
        this.visibleAmount = visible;
        this.minimum = minimum;
        this.maximum = maximum;
        ScrollbarPeer peer = (ScrollbarPeer)this.peer;
        if (peer != null) {
            peer.setValues(value, visibleAmount, minimum, maximum);
        }
    }

    if ((oldValue != value) && (accessibleContext != null))  {
        accessibleContext.firePropertyChange(
                AccessibleContext.ACCESSIBLE_VALUE_PROPERTY,
                Integer.valueOf(oldValue),
                Integer.valueOf(value));
    }
}
 
Example 4
Source File: Scrollbar.java    From jdk8u-jdk with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Sets the values of four properties for this scroll bar:
 * <code>value</code>, <code>visibleAmount</code>,
 * <code>minimum</code>, and <code>maximum</code>.
 * If the values supplied for these properties are inconsistent
 * or incorrect, they will be changed to ensure consistency.
 * <p>
 * This method simultaneously and synchronously sets the values
 * of four scroll bar properties, assuring that the values of
 * these properties are mutually consistent. It enforces the
 * following constraints:
 * <code>maximum</code> must be greater than <code>minimum</code>,
 * <code>maximum - minimum</code> must not be greater
 *     than <code>Integer.MAX_VALUE</code>,
 * <code>visibleAmount</code> must be greater than zero.
 * <code>visibleAmount</code> must not be greater than
 *     <code>maximum - minimum</code>,
 * <code>value</code> must not be less than <code>minimum</code>,
 * and <code>value</code> must not be greater than
 *     <code>maximum - visibleAmount</code>
 * <p>
 * Calling this method does not fire an
 * <code>AdjustmentEvent</code>.
 *
 * @param      value is the position in the current window
 * @param      visible is the visible amount of the scroll bar
 * @param      minimum is the minimum value of the scroll bar
 * @param      maximum is the maximum value of the scroll bar
 * @see        #setMinimum
 * @see        #setMaximum
 * @see        #setVisibleAmount
 * @see        #setValue
 */
public void setValues(int value, int visible, int minimum, int maximum) {
    int oldValue;
    synchronized (this) {
        if (minimum == Integer.MAX_VALUE) {
            minimum = Integer.MAX_VALUE - 1;
        }
        if (maximum <= minimum) {
            maximum = minimum + 1;
        }

        long maxMinusMin = (long) maximum - (long) minimum;
        if (maxMinusMin > Integer.MAX_VALUE) {
            maxMinusMin = Integer.MAX_VALUE;
            maximum = minimum + (int) maxMinusMin;
        }
        if (visible > (int) maxMinusMin) {
            visible = (int) maxMinusMin;
        }
        if (visible < 1) {
            visible = 1;
        }

        if (value < minimum) {
            value = minimum;
        }
        if (value > maximum - visible) {
            value = maximum - visible;
        }

        oldValue = this.value;
        this.value = value;
        this.visibleAmount = visible;
        this.minimum = minimum;
        this.maximum = maximum;
        ScrollbarPeer peer = (ScrollbarPeer)this.peer;
        if (peer != null) {
            peer.setValues(value, visibleAmount, minimum, maximum);
        }
    }

    if ((oldValue != value) && (accessibleContext != null))  {
        accessibleContext.firePropertyChange(
                AccessibleContext.ACCESSIBLE_VALUE_PROPERTY,
                Integer.valueOf(oldValue),
                Integer.valueOf(value));
    }
}
 
Example 5
Source File: Scrollbar.java    From jdk8u_jdk with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Sets the values of four properties for this scroll bar:
 * <code>value</code>, <code>visibleAmount</code>,
 * <code>minimum</code>, and <code>maximum</code>.
 * If the values supplied for these properties are inconsistent
 * or incorrect, they will be changed to ensure consistency.
 * <p>
 * This method simultaneously and synchronously sets the values
 * of four scroll bar properties, assuring that the values of
 * these properties are mutually consistent. It enforces the
 * following constraints:
 * <code>maximum</code> must be greater than <code>minimum</code>,
 * <code>maximum - minimum</code> must not be greater
 *     than <code>Integer.MAX_VALUE</code>,
 * <code>visibleAmount</code> must be greater than zero.
 * <code>visibleAmount</code> must not be greater than
 *     <code>maximum - minimum</code>,
 * <code>value</code> must not be less than <code>minimum</code>,
 * and <code>value</code> must not be greater than
 *     <code>maximum - visibleAmount</code>
 * <p>
 * Calling this method does not fire an
 * <code>AdjustmentEvent</code>.
 *
 * @param      value is the position in the current window
 * @param      visible is the visible amount of the scroll bar
 * @param      minimum is the minimum value of the scroll bar
 * @param      maximum is the maximum value of the scroll bar
 * @see        #setMinimum
 * @see        #setMaximum
 * @see        #setVisibleAmount
 * @see        #setValue
 */
public void setValues(int value, int visible, int minimum, int maximum) {
    int oldValue;
    synchronized (this) {
        if (minimum == Integer.MAX_VALUE) {
            minimum = Integer.MAX_VALUE - 1;
        }
        if (maximum <= minimum) {
            maximum = minimum + 1;
        }

        long maxMinusMin = (long) maximum - (long) minimum;
        if (maxMinusMin > Integer.MAX_VALUE) {
            maxMinusMin = Integer.MAX_VALUE;
            maximum = minimum + (int) maxMinusMin;
        }
        if (visible > (int) maxMinusMin) {
            visible = (int) maxMinusMin;
        }
        if (visible < 1) {
            visible = 1;
        }

        if (value < minimum) {
            value = minimum;
        }
        if (value > maximum - visible) {
            value = maximum - visible;
        }

        oldValue = this.value;
        this.value = value;
        this.visibleAmount = visible;
        this.minimum = minimum;
        this.maximum = maximum;
        ScrollbarPeer peer = (ScrollbarPeer)this.peer;
        if (peer != null) {
            peer.setValues(value, visibleAmount, minimum, maximum);
        }
    }

    if ((oldValue != value) && (accessibleContext != null))  {
        accessibleContext.firePropertyChange(
                AccessibleContext.ACCESSIBLE_VALUE_PROPERTY,
                Integer.valueOf(oldValue),
                Integer.valueOf(value));
    }
}
 
Example 6
Source File: Scrollbar.java    From openjdk-8 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Sets the values of four properties for this scroll bar:
 * <code>value</code>, <code>visibleAmount</code>,
 * <code>minimum</code>, and <code>maximum</code>.
 * If the values supplied for these properties are inconsistent
 * or incorrect, they will be changed to ensure consistency.
 * <p>
 * This method simultaneously and synchronously sets the values
 * of four scroll bar properties, assuring that the values of
 * these properties are mutually consistent. It enforces the
 * following constraints:
 * <code>maximum</code> must be greater than <code>minimum</code>,
 * <code>maximum - minimum</code> must not be greater
 *     than <code>Integer.MAX_VALUE</code>,
 * <code>visibleAmount</code> must be greater than zero.
 * <code>visibleAmount</code> must not be greater than
 *     <code>maximum - minimum</code>,
 * <code>value</code> must not be less than <code>minimum</code>,
 * and <code>value</code> must not be greater than
 *     <code>maximum - visibleAmount</code>
 * <p>
 * Calling this method does not fire an
 * <code>AdjustmentEvent</code>.
 *
 * @param      value is the position in the current window
 * @param      visible is the visible amount of the scroll bar
 * @param      minimum is the minimum value of the scroll bar
 * @param      maximum is the maximum value of the scroll bar
 * @see        #setMinimum
 * @see        #setMaximum
 * @see        #setVisibleAmount
 * @see        #setValue
 */
public void setValues(int value, int visible, int minimum, int maximum) {
    int oldValue;
    synchronized (this) {
        if (minimum == Integer.MAX_VALUE) {
            minimum = Integer.MAX_VALUE - 1;
        }
        if (maximum <= minimum) {
            maximum = minimum + 1;
        }

        long maxMinusMin = (long) maximum - (long) minimum;
        if (maxMinusMin > Integer.MAX_VALUE) {
            maxMinusMin = Integer.MAX_VALUE;
            maximum = minimum + (int) maxMinusMin;
        }
        if (visible > (int) maxMinusMin) {
            visible = (int) maxMinusMin;
        }
        if (visible < 1) {
            visible = 1;
        }

        if (value < minimum) {
            value = minimum;
        }
        if (value > maximum - visible) {
            value = maximum - visible;
        }

        oldValue = this.value;
        this.value = value;
        this.visibleAmount = visible;
        this.minimum = minimum;
        this.maximum = maximum;
        ScrollbarPeer peer = (ScrollbarPeer)this.peer;
        if (peer != null) {
            peer.setValues(value, visibleAmount, minimum, maximum);
        }
    }

    if ((oldValue != value) && (accessibleContext != null))  {
        accessibleContext.firePropertyChange(
                AccessibleContext.ACCESSIBLE_VALUE_PROPERTY,
                Integer.valueOf(oldValue),
                Integer.valueOf(value));
    }
}
 
Example 7
Source File: Scrollbar.java    From openjdk-8-source with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Sets the values of four properties for this scroll bar:
 * <code>value</code>, <code>visibleAmount</code>,
 * <code>minimum</code>, and <code>maximum</code>.
 * If the values supplied for these properties are inconsistent
 * or incorrect, they will be changed to ensure consistency.
 * <p>
 * This method simultaneously and synchronously sets the values
 * of four scroll bar properties, assuring that the values of
 * these properties are mutually consistent. It enforces the
 * following constraints:
 * <code>maximum</code> must be greater than <code>minimum</code>,
 * <code>maximum - minimum</code> must not be greater
 *     than <code>Integer.MAX_VALUE</code>,
 * <code>visibleAmount</code> must be greater than zero.
 * <code>visibleAmount</code> must not be greater than
 *     <code>maximum - minimum</code>,
 * <code>value</code> must not be less than <code>minimum</code>,
 * and <code>value</code> must not be greater than
 *     <code>maximum - visibleAmount</code>
 * <p>
 * Calling this method does not fire an
 * <code>AdjustmentEvent</code>.
 *
 * @param      value is the position in the current window
 * @param      visible is the visible amount of the scroll bar
 * @param      minimum is the minimum value of the scroll bar
 * @param      maximum is the maximum value of the scroll bar
 * @see        #setMinimum
 * @see        #setMaximum
 * @see        #setVisibleAmount
 * @see        #setValue
 */
public void setValues(int value, int visible, int minimum, int maximum) {
    int oldValue;
    synchronized (this) {
        if (minimum == Integer.MAX_VALUE) {
            minimum = Integer.MAX_VALUE - 1;
        }
        if (maximum <= minimum) {
            maximum = minimum + 1;
        }

        long maxMinusMin = (long) maximum - (long) minimum;
        if (maxMinusMin > Integer.MAX_VALUE) {
            maxMinusMin = Integer.MAX_VALUE;
            maximum = minimum + (int) maxMinusMin;
        }
        if (visible > (int) maxMinusMin) {
            visible = (int) maxMinusMin;
        }
        if (visible < 1) {
            visible = 1;
        }

        if (value < minimum) {
            value = minimum;
        }
        if (value > maximum - visible) {
            value = maximum - visible;
        }

        oldValue = this.value;
        this.value = value;
        this.visibleAmount = visible;
        this.minimum = minimum;
        this.maximum = maximum;
        ScrollbarPeer peer = (ScrollbarPeer)this.peer;
        if (peer != null) {
            peer.setValues(value, visibleAmount, minimum, maximum);
        }
    }

    if ((oldValue != value) && (accessibleContext != null))  {
        accessibleContext.firePropertyChange(
                AccessibleContext.ACCESSIBLE_VALUE_PROPERTY,
                Integer.valueOf(oldValue),
                Integer.valueOf(value));
    }
}
 
Example 8
Source File: Scrollbar.java    From hottub with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Sets the values of four properties for this scroll bar:
 * <code>value</code>, <code>visibleAmount</code>,
 * <code>minimum</code>, and <code>maximum</code>.
 * If the values supplied for these properties are inconsistent
 * or incorrect, they will be changed to ensure consistency.
 * <p>
 * This method simultaneously and synchronously sets the values
 * of four scroll bar properties, assuring that the values of
 * these properties are mutually consistent. It enforces the
 * following constraints:
 * <code>maximum</code> must be greater than <code>minimum</code>,
 * <code>maximum - minimum</code> must not be greater
 *     than <code>Integer.MAX_VALUE</code>,
 * <code>visibleAmount</code> must be greater than zero.
 * <code>visibleAmount</code> must not be greater than
 *     <code>maximum - minimum</code>,
 * <code>value</code> must not be less than <code>minimum</code>,
 * and <code>value</code> must not be greater than
 *     <code>maximum - visibleAmount</code>
 * <p>
 * Calling this method does not fire an
 * <code>AdjustmentEvent</code>.
 *
 * @param      value is the position in the current window
 * @param      visible is the visible amount of the scroll bar
 * @param      minimum is the minimum value of the scroll bar
 * @param      maximum is the maximum value of the scroll bar
 * @see        #setMinimum
 * @see        #setMaximum
 * @see        #setVisibleAmount
 * @see        #setValue
 */
public void setValues(int value, int visible, int minimum, int maximum) {
    int oldValue;
    synchronized (this) {
        if (minimum == Integer.MAX_VALUE) {
            minimum = Integer.MAX_VALUE - 1;
        }
        if (maximum <= minimum) {
            maximum = minimum + 1;
        }

        long maxMinusMin = (long) maximum - (long) minimum;
        if (maxMinusMin > Integer.MAX_VALUE) {
            maxMinusMin = Integer.MAX_VALUE;
            maximum = minimum + (int) maxMinusMin;
        }
        if (visible > (int) maxMinusMin) {
            visible = (int) maxMinusMin;
        }
        if (visible < 1) {
            visible = 1;
        }

        if (value < minimum) {
            value = minimum;
        }
        if (value > maximum - visible) {
            value = maximum - visible;
        }

        oldValue = this.value;
        this.value = value;
        this.visibleAmount = visible;
        this.minimum = minimum;
        this.maximum = maximum;
        ScrollbarPeer peer = (ScrollbarPeer)this.peer;
        if (peer != null) {
            peer.setValues(value, visibleAmount, minimum, maximum);
        }
    }

    if ((oldValue != value) && (accessibleContext != null))  {
        accessibleContext.firePropertyChange(
                AccessibleContext.ACCESSIBLE_VALUE_PROPERTY,
                Integer.valueOf(oldValue),
                Integer.valueOf(value));
    }
}
 
Example 9
Source File: Scrollbar.java    From Java8CN with Apache License 2.0 4 votes vote down vote up
/**
 * Sets the values of four properties for this scroll bar:
 * <code>value</code>, <code>visibleAmount</code>,
 * <code>minimum</code>, and <code>maximum</code>.
 * If the values supplied for these properties are inconsistent
 * or incorrect, they will be changed to ensure consistency.
 * <p>
 * This method simultaneously and synchronously sets the values
 * of four scroll bar properties, assuring that the values of
 * these properties are mutually consistent. It enforces the
 * following constraints:
 * <code>maximum</code> must be greater than <code>minimum</code>,
 * <code>maximum - minimum</code> must not be greater
 *     than <code>Integer.MAX_VALUE</code>,
 * <code>visibleAmount</code> must be greater than zero.
 * <code>visibleAmount</code> must not be greater than
 *     <code>maximum - minimum</code>,
 * <code>value</code> must not be less than <code>minimum</code>,
 * and <code>value</code> must not be greater than
 *     <code>maximum - visibleAmount</code>
 * <p>
 * Calling this method does not fire an
 * <code>AdjustmentEvent</code>.
 *
 * @param      value is the position in the current window
 * @param      visible is the visible amount of the scroll bar
 * @param      minimum is the minimum value of the scroll bar
 * @param      maximum is the maximum value of the scroll bar
 * @see        #setMinimum
 * @see        #setMaximum
 * @see        #setVisibleAmount
 * @see        #setValue
 */
public void setValues(int value, int visible, int minimum, int maximum) {
    int oldValue;
    synchronized (this) {
        if (minimum == Integer.MAX_VALUE) {
            minimum = Integer.MAX_VALUE - 1;
        }
        if (maximum <= minimum) {
            maximum = minimum + 1;
        }

        long maxMinusMin = (long) maximum - (long) minimum;
        if (maxMinusMin > Integer.MAX_VALUE) {
            maxMinusMin = Integer.MAX_VALUE;
            maximum = minimum + (int) maxMinusMin;
        }
        if (visible > (int) maxMinusMin) {
            visible = (int) maxMinusMin;
        }
        if (visible < 1) {
            visible = 1;
        }

        if (value < minimum) {
            value = minimum;
        }
        if (value > maximum - visible) {
            value = maximum - visible;
        }

        oldValue = this.value;
        this.value = value;
        this.visibleAmount = visible;
        this.minimum = minimum;
        this.maximum = maximum;
        ScrollbarPeer peer = (ScrollbarPeer)this.peer;
        if (peer != null) {
            peer.setValues(value, visibleAmount, minimum, maximum);
        }
    }

    if ((oldValue != value) && (accessibleContext != null))  {
        accessibleContext.firePropertyChange(
                AccessibleContext.ACCESSIBLE_VALUE_PROPERTY,
                Integer.valueOf(oldValue),
                Integer.valueOf(value));
    }
}
 
Example 10
Source File: Scrollbar.java    From jdk1.8-source-analysis with Apache License 2.0 4 votes vote down vote up
/**
 * Sets the values of four properties for this scroll bar:
 * <code>value</code>, <code>visibleAmount</code>,
 * <code>minimum</code>, and <code>maximum</code>.
 * If the values supplied for these properties are inconsistent
 * or incorrect, they will be changed to ensure consistency.
 * <p>
 * This method simultaneously and synchronously sets the values
 * of four scroll bar properties, assuring that the values of
 * these properties are mutually consistent. It enforces the
 * following constraints:
 * <code>maximum</code> must be greater than <code>minimum</code>,
 * <code>maximum - minimum</code> must not be greater
 *     than <code>Integer.MAX_VALUE</code>,
 * <code>visibleAmount</code> must be greater than zero.
 * <code>visibleAmount</code> must not be greater than
 *     <code>maximum - minimum</code>,
 * <code>value</code> must not be less than <code>minimum</code>,
 * and <code>value</code> must not be greater than
 *     <code>maximum - visibleAmount</code>
 * <p>
 * Calling this method does not fire an
 * <code>AdjustmentEvent</code>.
 *
 * @param      value is the position in the current window
 * @param      visible is the visible amount of the scroll bar
 * @param      minimum is the minimum value of the scroll bar
 * @param      maximum is the maximum value of the scroll bar
 * @see        #setMinimum
 * @see        #setMaximum
 * @see        #setVisibleAmount
 * @see        #setValue
 */
public void setValues(int value, int visible, int minimum, int maximum) {
    int oldValue;
    synchronized (this) {
        if (minimum == Integer.MAX_VALUE) {
            minimum = Integer.MAX_VALUE - 1;
        }
        if (maximum <= minimum) {
            maximum = minimum + 1;
        }

        long maxMinusMin = (long) maximum - (long) minimum;
        if (maxMinusMin > Integer.MAX_VALUE) {
            maxMinusMin = Integer.MAX_VALUE;
            maximum = minimum + (int) maxMinusMin;
        }
        if (visible > (int) maxMinusMin) {
            visible = (int) maxMinusMin;
        }
        if (visible < 1) {
            visible = 1;
        }

        if (value < minimum) {
            value = minimum;
        }
        if (value > maximum - visible) {
            value = maximum - visible;
        }

        oldValue = this.value;
        this.value = value;
        this.visibleAmount = visible;
        this.minimum = minimum;
        this.maximum = maximum;
        ScrollbarPeer peer = (ScrollbarPeer)this.peer;
        if (peer != null) {
            peer.setValues(value, visibleAmount, minimum, maximum);
        }
    }

    if ((oldValue != value) && (accessibleContext != null))  {
        accessibleContext.firePropertyChange(
                AccessibleContext.ACCESSIBLE_VALUE_PROPERTY,
                Integer.valueOf(oldValue),
                Integer.valueOf(value));
    }
}
 
Example 11
Source File: Scrollbar.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Sets the values of four properties for this scroll bar:
 * {@code value}, {@code visibleAmount},
 * {@code minimum}, and {@code maximum}.
 * If the values supplied for these properties are inconsistent
 * or incorrect, they will be changed to ensure consistency.
 * <p>
 * This method simultaneously and synchronously sets the values
 * of four scroll bar properties, assuring that the values of
 * these properties are mutually consistent. It enforces the
 * following constraints:
 * {@code maximum} must be greater than {@code minimum},
 * {@code maximum - minimum} must not be greater
 *     than {@code Integer.MAX_VALUE},
 * {@code visibleAmount} must be greater than zero.
 * {@code visibleAmount} must not be greater than
 *     {@code maximum - minimum},
 * {@code value} must not be less than {@code minimum},
 * and {@code value} must not be greater than
 *     {@code maximum - visibleAmount}
 * <p>
 * Calling this method does not fire an
 * {@code AdjustmentEvent}.
 *
 * @param      value is the position in the current window
 * @param      visible is the visible amount of the scroll bar
 * @param      minimum is the minimum value of the scroll bar
 * @param      maximum is the maximum value of the scroll bar
 * @see        #setMinimum
 * @see        #setMaximum
 * @see        #setVisibleAmount
 * @see        #setValue
 */
public void setValues(int value, int visible, int minimum, int maximum) {
    int oldValue;
    synchronized (this) {
        if (minimum == Integer.MAX_VALUE) {
            minimum = Integer.MAX_VALUE - 1;
        }
        if (maximum <= minimum) {
            maximum = minimum + 1;
        }

        long maxMinusMin = (long) maximum - (long) minimum;
        if (maxMinusMin > Integer.MAX_VALUE) {
            maxMinusMin = Integer.MAX_VALUE;
            maximum = minimum + (int) maxMinusMin;
        }
        if (visible > (int) maxMinusMin) {
            visible = (int) maxMinusMin;
        }
        if (visible < 1) {
            visible = 1;
        }

        if (value < minimum) {
            value = minimum;
        }
        if (value > maximum - visible) {
            value = maximum - visible;
        }

        oldValue = this.value;
        this.value = value;
        this.visibleAmount = visible;
        this.minimum = minimum;
        this.maximum = maximum;
        ScrollbarPeer peer = (ScrollbarPeer)this.peer;
        if (peer != null) {
            peer.setValues(value, visibleAmount, minimum, maximum);
        }
    }

    if ((oldValue != value) && (accessibleContext != null))  {
        accessibleContext.firePropertyChange(
                AccessibleContext.ACCESSIBLE_VALUE_PROPERTY,
                Integer.valueOf(oldValue),
                Integer.valueOf(value));
    }
}
 
Example 12
Source File: Scrollbar.java    From Bytecoder with Apache License 2.0 4 votes vote down vote up
/**
 * Sets the values of four properties for this scroll bar:
 * {@code value}, {@code visibleAmount},
 * {@code minimum}, and {@code maximum}.
 * If the values supplied for these properties are inconsistent
 * or incorrect, they will be changed to ensure consistency.
 * <p>
 * This method simultaneously and synchronously sets the values
 * of four scroll bar properties, assuring that the values of
 * these properties are mutually consistent. It enforces the
 * following constraints:
 * {@code maximum} must be greater than {@code minimum},
 * {@code maximum - minimum} must not be greater
 *     than {@code Integer.MAX_VALUE},
 * {@code visibleAmount} must be greater than zero.
 * {@code visibleAmount} must not be greater than
 *     {@code maximum - minimum},
 * {@code value} must not be less than {@code minimum},
 * and {@code value} must not be greater than
 *     {@code maximum - visibleAmount}
 * <p>
 * Calling this method does not fire an
 * {@code AdjustmentEvent}.
 *
 * @param      value is the position in the current window
 * @param      visible is the visible amount of the scroll bar
 * @param      minimum is the minimum value of the scroll bar
 * @param      maximum is the maximum value of the scroll bar
 * @see        #setMinimum
 * @see        #setMaximum
 * @see        #setVisibleAmount
 * @see        #setValue
 */
public void setValues(int value, int visible, int minimum, int maximum) {
    int oldValue;
    synchronized (this) {
        if (minimum == Integer.MAX_VALUE) {
            minimum = Integer.MAX_VALUE - 1;
        }
        if (maximum <= minimum) {
            maximum = minimum + 1;
        }

        long maxMinusMin = (long) maximum - (long) minimum;
        if (maxMinusMin > Integer.MAX_VALUE) {
            maxMinusMin = Integer.MAX_VALUE;
            maximum = minimum + (int) maxMinusMin;
        }
        if (visible > (int) maxMinusMin) {
            visible = (int) maxMinusMin;
        }
        if (visible < 1) {
            visible = 1;
        }

        if (value < minimum) {
            value = minimum;
        }
        if (value > maximum - visible) {
            value = maximum - visible;
        }

        oldValue = this.value;
        this.value = value;
        this.visibleAmount = visible;
        this.minimum = minimum;
        this.maximum = maximum;
        ScrollbarPeer peer = (ScrollbarPeer)this.peer;
        if (peer != null) {
            peer.setValues(value, visibleAmount, minimum, maximum);
        }
    }

    if ((oldValue != value) && (accessibleContext != null))  {
        accessibleContext.firePropertyChange(
                AccessibleContext.ACCESSIBLE_VALUE_PROPERTY,
                Integer.valueOf(oldValue),
                Integer.valueOf(value));
    }
}
 
Example 13
Source File: Scrollbar.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Sets the values of four properties for this scroll bar:
 * <code>value</code>, <code>visibleAmount</code>,
 * <code>minimum</code>, and <code>maximum</code>.
 * If the values supplied for these properties are inconsistent
 * or incorrect, they will be changed to ensure consistency.
 * <p>
 * This method simultaneously and synchronously sets the values
 * of four scroll bar properties, assuring that the values of
 * these properties are mutually consistent. It enforces the
 * following constraints:
 * <code>maximum</code> must be greater than <code>minimum</code>,
 * <code>maximum - minimum</code> must not be greater
 *     than <code>Integer.MAX_VALUE</code>,
 * <code>visibleAmount</code> must be greater than zero.
 * <code>visibleAmount</code> must not be greater than
 *     <code>maximum - minimum</code>,
 * <code>value</code> must not be less than <code>minimum</code>,
 * and <code>value</code> must not be greater than
 *     <code>maximum - visibleAmount</code>
 * <p>
 * Calling this method does not fire an
 * <code>AdjustmentEvent</code>.
 *
 * @param      value is the position in the current window
 * @param      visible is the visible amount of the scroll bar
 * @param      minimum is the minimum value of the scroll bar
 * @param      maximum is the maximum value of the scroll bar
 * @see        #setMinimum
 * @see        #setMaximum
 * @see        #setVisibleAmount
 * @see        #setValue
 */
public void setValues(int value, int visible, int minimum, int maximum) {
    int oldValue;
    synchronized (this) {
        if (minimum == Integer.MAX_VALUE) {
            minimum = Integer.MAX_VALUE - 1;
        }
        if (maximum <= minimum) {
            maximum = minimum + 1;
        }

        long maxMinusMin = (long) maximum - (long) minimum;
        if (maxMinusMin > Integer.MAX_VALUE) {
            maxMinusMin = Integer.MAX_VALUE;
            maximum = minimum + (int) maxMinusMin;
        }
        if (visible > (int) maxMinusMin) {
            visible = (int) maxMinusMin;
        }
        if (visible < 1) {
            visible = 1;
        }

        if (value < minimum) {
            value = minimum;
        }
        if (value > maximum - visible) {
            value = maximum - visible;
        }

        oldValue = this.value;
        this.value = value;
        this.visibleAmount = visible;
        this.minimum = minimum;
        this.maximum = maximum;
        ScrollbarPeer peer = (ScrollbarPeer)this.peer;
        if (peer != null) {
            peer.setValues(value, visibleAmount, minimum, maximum);
        }
    }

    if ((oldValue != value) && (accessibleContext != null))  {
        accessibleContext.firePropertyChange(
                AccessibleContext.ACCESSIBLE_VALUE_PROPERTY,
                Integer.valueOf(oldValue),
                Integer.valueOf(value));
    }
}
 
Example 14
Source File: Scrollbar.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Sets the values of four properties for this scroll bar:
 * <code>value</code>, <code>visibleAmount</code>,
 * <code>minimum</code>, and <code>maximum</code>.
 * If the values supplied for these properties are inconsistent
 * or incorrect, they will be changed to ensure consistency.
 * <p>
 * This method simultaneously and synchronously sets the values
 * of four scroll bar properties, assuring that the values of
 * these properties are mutually consistent. It enforces the
 * following constraints:
 * <code>maximum</code> must be greater than <code>minimum</code>,
 * <code>maximum - minimum</code> must not be greater
 *     than <code>Integer.MAX_VALUE</code>,
 * <code>visibleAmount</code> must be greater than zero.
 * <code>visibleAmount</code> must not be greater than
 *     <code>maximum - minimum</code>,
 * <code>value</code> must not be less than <code>minimum</code>,
 * and <code>value</code> must not be greater than
 *     <code>maximum - visibleAmount</code>
 * <p>
 * Calling this method does not fire an
 * <code>AdjustmentEvent</code>.
 *
 * @param      value is the position in the current window
 * @param      visible is the visible amount of the scroll bar
 * @param      minimum is the minimum value of the scroll bar
 * @param      maximum is the maximum value of the scroll bar
 * @see        #setMinimum
 * @see        #setMaximum
 * @see        #setVisibleAmount
 * @see        #setValue
 */
public void setValues(int value, int visible, int minimum, int maximum) {
    int oldValue;
    synchronized (this) {
        if (minimum == Integer.MAX_VALUE) {
            minimum = Integer.MAX_VALUE - 1;
        }
        if (maximum <= minimum) {
            maximum = minimum + 1;
        }

        long maxMinusMin = (long) maximum - (long) minimum;
        if (maxMinusMin > Integer.MAX_VALUE) {
            maxMinusMin = Integer.MAX_VALUE;
            maximum = minimum + (int) maxMinusMin;
        }
        if (visible > (int) maxMinusMin) {
            visible = (int) maxMinusMin;
        }
        if (visible < 1) {
            visible = 1;
        }

        if (value < minimum) {
            value = minimum;
        }
        if (value > maximum - visible) {
            value = maximum - visible;
        }

        oldValue = this.value;
        this.value = value;
        this.visibleAmount = visible;
        this.minimum = minimum;
        this.maximum = maximum;
        ScrollbarPeer peer = (ScrollbarPeer)this.peer;
        if (peer != null) {
            peer.setValues(value, visibleAmount, minimum, maximum);
        }
    }

    if ((oldValue != value) && (accessibleContext != null))  {
        accessibleContext.firePropertyChange(
                AccessibleContext.ACCESSIBLE_VALUE_PROPERTY,
                Integer.valueOf(oldValue),
                Integer.valueOf(value));
    }
}
 
Example 15
Source File: Scrollbar.java    From JDKSourceCode1.8 with MIT License 4 votes vote down vote up
/**
 * Sets the values of four properties for this scroll bar:
 * <code>value</code>, <code>visibleAmount</code>,
 * <code>minimum</code>, and <code>maximum</code>.
 * If the values supplied for these properties are inconsistent
 * or incorrect, they will be changed to ensure consistency.
 * <p>
 * This method simultaneously and synchronously sets the values
 * of four scroll bar properties, assuring that the values of
 * these properties are mutually consistent. It enforces the
 * following constraints:
 * <code>maximum</code> must be greater than <code>minimum</code>,
 * <code>maximum - minimum</code> must not be greater
 *     than <code>Integer.MAX_VALUE</code>,
 * <code>visibleAmount</code> must be greater than zero.
 * <code>visibleAmount</code> must not be greater than
 *     <code>maximum - minimum</code>,
 * <code>value</code> must not be less than <code>minimum</code>,
 * and <code>value</code> must not be greater than
 *     <code>maximum - visibleAmount</code>
 * <p>
 * Calling this method does not fire an
 * <code>AdjustmentEvent</code>.
 *
 * @param      value is the position in the current window
 * @param      visible is the visible amount of the scroll bar
 * @param      minimum is the minimum value of the scroll bar
 * @param      maximum is the maximum value of the scroll bar
 * @see        #setMinimum
 * @see        #setMaximum
 * @see        #setVisibleAmount
 * @see        #setValue
 */
public void setValues(int value, int visible, int minimum, int maximum) {
    int oldValue;
    synchronized (this) {
        if (minimum == Integer.MAX_VALUE) {
            minimum = Integer.MAX_VALUE - 1;
        }
        if (maximum <= minimum) {
            maximum = minimum + 1;
        }

        long maxMinusMin = (long) maximum - (long) minimum;
        if (maxMinusMin > Integer.MAX_VALUE) {
            maxMinusMin = Integer.MAX_VALUE;
            maximum = minimum + (int) maxMinusMin;
        }
        if (visible > (int) maxMinusMin) {
            visible = (int) maxMinusMin;
        }
        if (visible < 1) {
            visible = 1;
        }

        if (value < minimum) {
            value = minimum;
        }
        if (value > maximum - visible) {
            value = maximum - visible;
        }

        oldValue = this.value;
        this.value = value;
        this.visibleAmount = visible;
        this.minimum = minimum;
        this.maximum = maximum;
        ScrollbarPeer peer = (ScrollbarPeer)this.peer;
        if (peer != null) {
            peer.setValues(value, visibleAmount, minimum, maximum);
        }
    }

    if ((oldValue != value) && (accessibleContext != null))  {
        accessibleContext.firePropertyChange(
                AccessibleContext.ACCESSIBLE_VALUE_PROPERTY,
                Integer.valueOf(oldValue),
                Integer.valueOf(value));
    }
}
 
Example 16
Source File: Scrollbar.java    From jdk8u60 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Sets the values of four properties for this scroll bar:
 * <code>value</code>, <code>visibleAmount</code>,
 * <code>minimum</code>, and <code>maximum</code>.
 * If the values supplied for these properties are inconsistent
 * or incorrect, they will be changed to ensure consistency.
 * <p>
 * This method simultaneously and synchronously sets the values
 * of four scroll bar properties, assuring that the values of
 * these properties are mutually consistent. It enforces the
 * following constraints:
 * <code>maximum</code> must be greater than <code>minimum</code>,
 * <code>maximum - minimum</code> must not be greater
 *     than <code>Integer.MAX_VALUE</code>,
 * <code>visibleAmount</code> must be greater than zero.
 * <code>visibleAmount</code> must not be greater than
 *     <code>maximum - minimum</code>,
 * <code>value</code> must not be less than <code>minimum</code>,
 * and <code>value</code> must not be greater than
 *     <code>maximum - visibleAmount</code>
 * <p>
 * Calling this method does not fire an
 * <code>AdjustmentEvent</code>.
 *
 * @param      value is the position in the current window
 * @param      visible is the visible amount of the scroll bar
 * @param      minimum is the minimum value of the scroll bar
 * @param      maximum is the maximum value of the scroll bar
 * @see        #setMinimum
 * @see        #setMaximum
 * @see        #setVisibleAmount
 * @see        #setValue
 */
public void setValues(int value, int visible, int minimum, int maximum) {
    int oldValue;
    synchronized (this) {
        if (minimum == Integer.MAX_VALUE) {
            minimum = Integer.MAX_VALUE - 1;
        }
        if (maximum <= minimum) {
            maximum = minimum + 1;
        }

        long maxMinusMin = (long) maximum - (long) minimum;
        if (maxMinusMin > Integer.MAX_VALUE) {
            maxMinusMin = Integer.MAX_VALUE;
            maximum = minimum + (int) maxMinusMin;
        }
        if (visible > (int) maxMinusMin) {
            visible = (int) maxMinusMin;
        }
        if (visible < 1) {
            visible = 1;
        }

        if (value < minimum) {
            value = minimum;
        }
        if (value > maximum - visible) {
            value = maximum - visible;
        }

        oldValue = this.value;
        this.value = value;
        this.visibleAmount = visible;
        this.minimum = minimum;
        this.maximum = maximum;
        ScrollbarPeer peer = (ScrollbarPeer)this.peer;
        if (peer != null) {
            peer.setValues(value, visibleAmount, minimum, maximum);
        }
    }

    if ((oldValue != value) && (accessibleContext != null))  {
        accessibleContext.firePropertyChange(
                AccessibleContext.ACCESSIBLE_VALUE_PROPERTY,
                Integer.valueOf(oldValue),
                Integer.valueOf(value));
    }
}
 
Example 17
Source File: Scrollbar.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Sets the values of four properties for this scroll bar:
 * <code>value</code>, <code>visibleAmount</code>,
 * <code>minimum</code>, and <code>maximum</code>.
 * If the values supplied for these properties are inconsistent
 * or incorrect, they will be changed to ensure consistency.
 * <p>
 * This method simultaneously and synchronously sets the values
 * of four scroll bar properties, assuring that the values of
 * these properties are mutually consistent. It enforces the
 * following constraints:
 * <code>maximum</code> must be greater than <code>minimum</code>,
 * <code>maximum - minimum</code> must not be greater
 *     than <code>Integer.MAX_VALUE</code>,
 * <code>visibleAmount</code> must be greater than zero.
 * <code>visibleAmount</code> must not be greater than
 *     <code>maximum - minimum</code>,
 * <code>value</code> must not be less than <code>minimum</code>,
 * and <code>value</code> must not be greater than
 *     <code>maximum - visibleAmount</code>
 * <p>
 * Calling this method does not fire an
 * <code>AdjustmentEvent</code>.
 *
 * @param      value is the position in the current window
 * @param      visible is the visible amount of the scroll bar
 * @param      minimum is the minimum value of the scroll bar
 * @param      maximum is the maximum value of the scroll bar
 * @see        #setMinimum
 * @see        #setMaximum
 * @see        #setVisibleAmount
 * @see        #setValue
 */
public void setValues(int value, int visible, int minimum, int maximum) {
    int oldValue;
    synchronized (this) {
        if (minimum == Integer.MAX_VALUE) {
            minimum = Integer.MAX_VALUE - 1;
        }
        if (maximum <= minimum) {
            maximum = minimum + 1;
        }

        long maxMinusMin = (long) maximum - (long) minimum;
        if (maxMinusMin > Integer.MAX_VALUE) {
            maxMinusMin = Integer.MAX_VALUE;
            maximum = minimum + (int) maxMinusMin;
        }
        if (visible > (int) maxMinusMin) {
            visible = (int) maxMinusMin;
        }
        if (visible < 1) {
            visible = 1;
        }

        if (value < minimum) {
            value = minimum;
        }
        if (value > maximum - visible) {
            value = maximum - visible;
        }

        oldValue = this.value;
        this.value = value;
        this.visibleAmount = visible;
        this.minimum = minimum;
        this.maximum = maximum;
        ScrollbarPeer peer = (ScrollbarPeer)this.peer;
        if (peer != null) {
            peer.setValues(value, visibleAmount, minimum, maximum);
        }
    }

    if ((oldValue != value) && (accessibleContext != null))  {
        accessibleContext.firePropertyChange(
                AccessibleContext.ACCESSIBLE_VALUE_PROPERTY,
                Integer.valueOf(oldValue),
                Integer.valueOf(value));
    }
}
 
Example 18
Source File: Scrollbar.java    From dragonwell8_jdk with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Sets the values of four properties for this scroll bar:
 * <code>value</code>, <code>visibleAmount</code>,
 * <code>minimum</code>, and <code>maximum</code>.
 * If the values supplied for these properties are inconsistent
 * or incorrect, they will be changed to ensure consistency.
 * <p>
 * This method simultaneously and synchronously sets the values
 * of four scroll bar properties, assuring that the values of
 * these properties are mutually consistent. It enforces the
 * following constraints:
 * <code>maximum</code> must be greater than <code>minimum</code>,
 * <code>maximum - minimum</code> must not be greater
 *     than <code>Integer.MAX_VALUE</code>,
 * <code>visibleAmount</code> must be greater than zero.
 * <code>visibleAmount</code> must not be greater than
 *     <code>maximum - minimum</code>,
 * <code>value</code> must not be less than <code>minimum</code>,
 * and <code>value</code> must not be greater than
 *     <code>maximum - visibleAmount</code>
 * <p>
 * Calling this method does not fire an
 * <code>AdjustmentEvent</code>.
 *
 * @param      value is the position in the current window
 * @param      visible is the visible amount of the scroll bar
 * @param      minimum is the minimum value of the scroll bar
 * @param      maximum is the maximum value of the scroll bar
 * @see        #setMinimum
 * @see        #setMaximum
 * @see        #setVisibleAmount
 * @see        #setValue
 */
public void setValues(int value, int visible, int minimum, int maximum) {
    int oldValue;
    synchronized (this) {
        if (minimum == Integer.MAX_VALUE) {
            minimum = Integer.MAX_VALUE - 1;
        }
        if (maximum <= minimum) {
            maximum = minimum + 1;
        }

        long maxMinusMin = (long) maximum - (long) minimum;
        if (maxMinusMin > Integer.MAX_VALUE) {
            maxMinusMin = Integer.MAX_VALUE;
            maximum = minimum + (int) maxMinusMin;
        }
        if (visible > (int) maxMinusMin) {
            visible = (int) maxMinusMin;
        }
        if (visible < 1) {
            visible = 1;
        }

        if (value < minimum) {
            value = minimum;
        }
        if (value > maximum - visible) {
            value = maximum - visible;
        }

        oldValue = this.value;
        this.value = value;
        this.visibleAmount = visible;
        this.minimum = minimum;
        this.maximum = maximum;
        ScrollbarPeer peer = (ScrollbarPeer)this.peer;
        if (peer != null) {
            peer.setValues(value, visibleAmount, minimum, maximum);
        }
    }

    if ((oldValue != value) && (accessibleContext != null))  {
        accessibleContext.firePropertyChange(
                AccessibleContext.ACCESSIBLE_VALUE_PROPERTY,
                Integer.valueOf(oldValue),
                Integer.valueOf(value));
    }
}