⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 scrollbar.java

📁 gcc的组建
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
  }  /**   * Sets the value added or subtracted to the scrollbar value when the   * user selects the scroll by a "unit" amount control.   *   * @param unitIncrement The new unit increment amount.   */  public synchronized void setUnitIncrement(int unitIncrement)  {    setLineIncrement(unitIncrement);  }  /**   * Sets the value added or subtracted to the scrollbar value when the   * user selects the scroll by a "unit" amount control.   *   * @param lineIncrement The new unit increment amount.   *   * @deprecated This method is deprecated in favor of   * <code>setUnitIncrement()</code>.   */  public void setLineIncrement(int lineIncrement)  {    if (lineIncrement < 0)      throw new IllegalArgumentException("Unit increment less than zero.");    int range = maximum - minimum;    if (lineIncrement > range)      {	if (range == 0)	  lineIncrement = 1;	else	  lineIncrement = range;      }    if (lineIncrement == this.lineIncrement)      return;    this.lineIncrement = lineIncrement;    ScrollbarPeer peer = (ScrollbarPeer) getPeer();    if (peer != null)      peer.setLineIncrement(this.lineIncrement);  }  /**   * Returns the value added or subtracted when the user activates the scrollbar   * scroll by a "block" amount.   *   * @return The block increment value.   */  public int getBlockIncrement()  {    return getPageIncrement();  }  /**   * Returns the value added or subtracted when the user selects the scrollbar   * scroll by a "block" amount control.   *   * @return The block increment value.   *   * @deprecated This method is deprecated in favor of   * <code>getBlockIncrement()</code>.   */  public int getPageIncrement()  {    return pageIncrement;  }  /**   * Sets the value added or subtracted to the scrollbar value when the   * user selects the scroll by a "block" amount control.   *   * @param blockIncrement The new block increment amount.   */  public synchronized void setBlockIncrement(int blockIncrement)  {    setPageIncrement(blockIncrement);  }  /**   * Sets the value added or subtracted to the scrollbar value when the   * user selects the scroll by a "block" amount control.   *   * @param pageIncrement The new block increment amount.   *   * @deprecated This method is deprecated in favor of   * <code>setBlockIncrement()</code>.   */  public void setPageIncrement(int pageIncrement)  {    if (pageIncrement < 0)      throw new IllegalArgumentException("Block increment less than zero.");    int range = maximum - minimum;    if (pageIncrement > range)      {	if (range == 0)	  pageIncrement = 1;	else	  pageIncrement = range;      }    if (pageIncrement == this.pageIncrement)      return;    this.pageIncrement = pageIncrement;    ScrollbarPeer peer = (ScrollbarPeer) getPeer();    if (peer != null)      peer.setPageIncrement(this.pageIncrement);  }  /**   * Notifies this object to create its native peer.   */  public synchronized void addNotify()  {    if (peer == null)      peer = getToolkit().createScrollbar(this);    super.addNotify();  }  /**   * Adds a new adjustment listener to the list of registered listeners   * for this object.   *   * @param listener The listener to add.   */  public synchronized void addAdjustmentListener(AdjustmentListener listener)  {    adjustment_listeners = AWTEventMulticaster.add(adjustment_listeners,                                                   listener);    enableEvents(AWTEvent.ADJUSTMENT_EVENT_MASK);  }  /**   * Removes the specified listener from the list of registered listeners   * for this object.   *   * @param listener The listener to remove.   */  public synchronized void removeAdjustmentListener(AdjustmentListener listener)  {    adjustment_listeners = AWTEventMulticaster.remove(adjustment_listeners,                                                      listener);  }  /**   * Processes events for this scrollbar.  It does this by calling   * <code>processAdjustmentEvent()</code> if the event is an instance of   * <code>AdjustmentEvent</code>, otherwise it calls the superclass to   * process the event.   *   * @param event The event to process.   */  protected void processEvent(AWTEvent event)  {    if (event instanceof AdjustmentEvent)      processAdjustmentEvent((AdjustmentEvent) event);    else      super.processEvent(event);  }  /**   * Processes adjustment events for this object by dispatching them to   * any registered listeners.  Note that this method will only be called   * if adjustment events are enabled.  This will happen automatically if   * any listeners are registered.  Otherwise, it can be enabled by a   * call to <code>enableEvents()</code>.   *   * @param event The event to process.   */  protected void processAdjustmentEvent(AdjustmentEvent event)  {    value = event.getValue();    if (adjustment_listeners != null)      adjustment_listeners.adjustmentValueChanged(event);  }  void dispatchEventImpl(AWTEvent e)  {    if (e.id <= AdjustmentEvent.ADJUSTMENT_LAST       && e.id >= AdjustmentEvent.ADJUSTMENT_FIRST      && (adjustment_listeners != null 	  || (eventMask & AWTEvent.ADJUSTMENT_EVENT_MASK) != 0))      processEvent(e);    else      super.dispatchEventImpl(e);  }  /**   * Returns a debugging string for this object.   *   * @return A debugging string for this object.   */  protected String paramString()  {    return ("value=" + getValue() + ",visibleAmount=" + getVisibleAmount()            + ",minimum=" + getMinimum() + ",maximum=" + getMaximum()            + ",pageIncrement=" + pageIncrement + ",lineIncrement="            + lineIncrement + ",orientation="            + (orientation == HORIZONTAL ? "HORIZONTAL" : "VERTICAL")            + super.paramString());  }  /**   * Returns an array of all the objects currently registered as FooListeners   * upon this <code>Scrollbar</code>. FooListeners are registered using the   * addFooListener method.   *   * @exception ClassCastException If listenerType doesn't specify a class or   * interface that implements java.util.EventListener.   */  public EventListener[] getListeners(Class listenerType)  {    if (listenerType == AdjustmentListener.class)      return AWTEventMulticaster.getListeners(adjustment_listeners,                                              listenerType);    return super.getListeners(listenerType);  }  /**   * Returns an array of all registered adjustment listeners.   */  public AdjustmentListener[] getAdjustmentListeners()  {    return (AdjustmentListener[]) getListeners(AdjustmentListener.class);  }  /**   * Returns true if the value is in the process of changing.   *   * @since 1.4   */  public boolean getValueIsAdjusting()  {    return valueIsAdjusting;  }  /**   * Sets the value of valueIsAdjusting.   *   * @since 1.4   */  public void setValueIsAdjusting(boolean valueIsAdjusting)  {    this.valueIsAdjusting = valueIsAdjusting;  }  /**   * Generate a unique name for this scroll bar.   *   * @return A unique name for this scroll bar.   */  String generateName()  {    return "scrollbar" + getUniqueLong();  }  private static synchronized long getUniqueLong()  {    return next_scrollbar_number++;  }  /**   * This class provides accessibility support for the   * scrollbar.   *   * @author Jerry Quinn (jlquinn@optonline.net)   * @author Andrew John Hughes (gnu_andrew@member.fsf.org)   */  protected class AccessibleAWTScrollBar extends AccessibleAWTComponent    implements AccessibleValue  {    /**     * Serialization constant to match JDK 1.5     */    private static final long serialVersionUID = -344337268523697807L;    /**     * Returns the role of this accessible object.     *     * @return the instance of <code>AccessibleRole</code>,     * which describes this object.     *     * @see javax.accessibility.AccessibleRole     */    public AccessibleRole getAccessibleRole()    {      return AccessibleRole.SCROLL_BAR;    }    /**     * Returns the state set of this accessible object.     *     * @return a set of <code>AccessibleState</code>s which     * represent the current state of the accessible object.     *     * @see javax.accessibility.AccessibleState     * @see javax.accessibility.AccessibleStateSet     */    public AccessibleStateSet getAccessibleStateSet()    {      AccessibleStateSet states = super.getAccessibleStateSet();      if (getOrientation() == HORIZONTAL)	states.add(AccessibleState.HORIZONTAL);      else	states.add(AccessibleState.VERTICAL);      if (getValueIsAdjusting())	states.add(AccessibleState.BUSY);      return states;    }    /**     * Returns an implementation of the <code>AccessibleValue</code>     * interface for this accessible object.  In this case, the     * current instance is simply returned (with a more appropriate     * type), as it also implements the accessible value as well as     * the context.     *     * @return the accessible value associated with this context.     *     * @see javax.accessibility.AccessibleValue     */    public AccessibleValue getAccessibleValue()    {      return this;    }    /**     * Returns the current value of this accessible object.     * In this case, this is the same as the value for     * the scrollbar, wrapped in an <code>Integer</code>     * object.     *     * @return the numeric value of this scrollbar.     *     * @see javax.accessibility.AccessibleValue#getCurrentAccessibleValue()     */    public Number getCurrentAccessibleValue()    {      return new Integer(getValue());    }    /**     * Sets the current value of this accessible object     * to that supplied.  In this case, the value of the     * scrollbar is set, and this method always returns     * true.     *     * @param number the new accessible value.     *     * @return true if the value was set.     *     * @see javax.accessibility.AccessibleValue#setCurrentAccessibleValue(java.lang.Number)     */    public boolean setCurrentAccessibleValue(Number number)    {      setValue(number.intValue());      return true;    }    /**     * Returns the minimum acceptable accessible value used     * by this object.  In this case, this is the same as     * the minimum value of the scrollbar, wrapped in an     * object.     *     * @return the minimum value of this scrollbar.     *     * @see javax.accessibility.AccessibleValue#getMinimumAccessibleValue()     */    public Number getMinimumAccessibleValue()    {      return new Integer(getMinimum());    }    /**     * Returns the maximum acceptable accessible value used     * by this object.  In this case, this is the same as     * the maximum value of the scrollbar, wrapped in an     * object.     *     * @return the maximum value of this scrollbar.     *     * @see javax.accessibility.AccessibleValue#getMaximumAccessibleValue()     */    public Number getMaximumAccessibleValue()    {      return new Integer(getMaximum());    }  }  /**   * Gets the AccessibleContext associated with this <code>Scrollbar</code>.   * The context is created, if necessary.   *   * @return the associated context   */  public AccessibleContext getAccessibleContext()  {    /* Create the context if this is the first request */    if (accessibleContext == null)      accessibleContext = new AccessibleAWTScrollBar();        return accessibleContext;  }}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -