当前位置: 首页>>代码示例>>Java>>正文


Java ScrollbarPeer.setValues方法代码示例

本文整理汇总了Java中java.awt.peer.ScrollbarPeer.setValues方法的典型用法代码示例。如果您正苦于以下问题:Java ScrollbarPeer.setValues方法的具体用法?Java ScrollbarPeer.setValues怎么用?Java ScrollbarPeer.setValues使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在java.awt.peer.ScrollbarPeer的用法示例。


在下文中一共展示了ScrollbarPeer.setValues方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: setValues

import java.awt.peer.ScrollbarPeer; //导入方法依赖的package包/类
/**
 * Sets the current value, visible amount, minimum, and maximum for this
 * scrollbar.  These values are adjusted to be internally consistent
 * if necessary.
 *
 * @param value The new value for this scrollbar.
 * @param visibleAmount The new visible amount for this scrollbar.
 * @param minimum The new minimum value for this scrollbar.
 * @param maximum The new maximum value for this scrollbar.
 */
public synchronized void setValues(int value, int visibleAmount,
                                   int minimum, int maximum)
{
  if (visibleAmount <= 0)
    visibleAmount = 1;

  if (maximum <= minimum)
    maximum = minimum + 1;

  if (value < minimum)
    value = minimum;

  if (visibleAmount > maximum - minimum)
    visibleAmount = maximum - minimum;

  // According to documentation, the actual maximum
  // value is (maximum - visibleAmount)
  if (value > maximum - visibleAmount)
    value = maximum - visibleAmount;

  ScrollbarPeer peer = (ScrollbarPeer) getPeer();
  if (peer != null
      && (this.value != value || this.visibleAmount != visibleAmount
          || this.minimum != minimum || this.maximum != maximum))
    peer.setValues(value, visibleAmount, minimum, maximum);

  this.value = value;
  this.visibleAmount = visibleAmount;
  this.minimum = minimum;
  this.maximum = maximum;
}
 
开发者ID:vilie,项目名称:javify,代码行数:42,代码来源:Scrollbar.java

示例2: setValues

import java.awt.peer.ScrollbarPeer; //导入方法依赖的package包/类
/**
 * Sets the current value, visible amount, minimum, and maximum for this
 * scrollbar.  These values are adjusted to be internally consistent
 * if necessary.
 *
 * @param value The new value for this scrollbar.
 * @param visibleAmount The new visible amount for this scrollbar.
 * @param minimum The new minimum value for this scrollbar.
 * @param maximum The new maximum value for this scrollbar.
 */
public synchronized void setValues(int value, int visibleAmount,
                                   int minimum, int maximum)
{
  if (visibleAmount <= 0)
    visibleAmount = 1;
  
  if (maximum <= minimum)
    maximum = minimum + 1;

  if (value < minimum)
    value = minimum;

  if (visibleAmount > maximum - minimum)
    visibleAmount = maximum - minimum;
  
  // According to documentation, the actual maximum
  // value is (maximum - visibleAmount)
  if (value > maximum - visibleAmount)
    value = maximum - visibleAmount;

  ScrollbarPeer peer = (ScrollbarPeer) getPeer();
  if (peer != null
      && (this.value != value || this.visibleAmount != visibleAmount
          || this.minimum != minimum || this.maximum != maximum))
    peer.setValues(value, visibleAmount, minimum, maximum);

  this.value = value;
  this.visibleAmount = visibleAmount;
  this.minimum = minimum;
  this.maximum = maximum;      
}
 
开发者ID:nmldiegues,项目名称:jvm-stm,代码行数:42,代码来源:Scrollbar.java

示例3: setValues

import java.awt.peer.ScrollbarPeer; //导入方法依赖的package包/类
/**
 * 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));
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:81,代码来源:Scrollbar.java

示例4: setValues

import java.awt.peer.ScrollbarPeer; //导入方法依赖的package包/类
/**
 * 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));
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:81,代码来源:Scrollbar.java

示例5: setValues

import java.awt.peer.ScrollbarPeer; //导入方法依赖的package包/类
/**
 * 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));
    }
}
 
开发者ID:jgaltidor,项目名称:VarJ,代码行数:81,代码来源:Scrollbar.java


注:本文中的java.awt.peer.ScrollbarPeer.setValues方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。