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

📄 jscrollbar.java

📁 gcc的组建
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
/* JScrollBar.java --   Copyright (C) 2002, 2004, 2005  Free Software Foundation, Inc.This file is part of GNU Classpath.GNU Classpath is free software; you can redistribute it and/or modifyit under the terms of the GNU General Public License as published bythe Free Software Foundation; either version 2, or (at your option)any later version.GNU Classpath is distributed in the hope that it will be useful, butWITHOUT ANY WARRANTY; without even the implied warranty ofMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNUGeneral Public License for more details.You should have received a copy of the GNU General Public Licensealong with GNU Classpath; see the file COPYING.  If not, write to theFree Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA02110-1301 USA.Linking this library statically or dynamically with other modules ismaking a combined work based on this library.  Thus, the terms andconditions of the GNU General Public License cover the wholecombination.As a special exception, the copyright holders of this library give youpermission to link this library with independent modules to produce anexecutable, regardless of the license terms of these independentmodules, and to copy and distribute the resulting executable underterms of your choice, provided that you also meet, for each linkedindependent module, the terms and conditions of the license of thatmodule.  An independent module is a module which is not derived fromor based on this library.  If you modify this library, you may extendthis exception to your version of the library, but you are notobligated to do so.  If you do not wish to do so, delete thisexception statement from your version. */package javax.swing;import java.awt.Adjustable;import java.awt.Dimension;import java.awt.event.AdjustmentEvent;import java.awt.event.AdjustmentListener;import javax.accessibility.Accessible;import javax.accessibility.AccessibleContext;import javax.accessibility.AccessibleRole;import javax.accessibility.AccessibleStateSet;import javax.accessibility.AccessibleValue;import javax.swing.plaf.ScrollBarUI;/** * The JScrollBar. Two buttons control how the values that the  * scroll bar can take. You can also drag the thumb or click the track * to move the scroll bar. Typically, the JScrollBar is used with * other components to translate the value of the bar to the viewable * contents of the other components. */public class JScrollBar extends JComponent implements Adjustable, Accessible{  /**   * DOCUMENT ME!   */  protected class AccessibleJScrollBar extends JComponent.AccessibleJComponent    implements AccessibleValue  {    private static final long serialVersionUID = -7758162392045586663L;        /**     * Creates a new AccessibleJSlider object.     */    protected AccessibleJScrollBar()    {      super();    }    /**     * DOCUMENT ME!     *     * @return DOCUMENT ME!     */    public AccessibleStateSet getAccessibleStateSet()    {      return null;    }    /**     * DOCUMENT ME!     *     * @return DOCUMENT ME!     */    public AccessibleRole getAccessibleRole()    {      return null;    }    /**     * DOCUMENT ME!     *     * @return DOCUMENT ME!     */    public AccessibleValue getAccessibleValue()    {      return null;    }    /**     * DOCUMENT ME!     *     * @return DOCUMENT ME!     */    public Number getCurrentAccessibleValue()    {      return null;    }    /**     * setCurrentAccessibleValue     *     * @param value0 TODO     *     * @return boolean     */    public boolean setCurrentAccessibleValue(Number value0)    {      return false;    }    /**     * getMinimumAccessibleValue     *     * @return Number     */    public Number getMinimumAccessibleValue()    {      return null;    }    /**     * getMaximumAccessibleValue     *     * @return Number     */    public Number getMaximumAccessibleValue()    {      return null;    }  }  private static final long serialVersionUID = -8195169869225066566L;    /** How much the thumb moves when moving in a block. */  protected int blockIncrement = 10;  /** The model that holds the scroll bar's data. */  protected BoundedRangeModel model;  /** The orientation of the scroll bar. */  protected int orientation = SwingConstants.VERTICAL;  /** How much the thumb moves when moving in a unit. */  protected int unitIncrement = 1;  /**    * Creates a new horizontal JScrollBar object with a minimum   * of 0, a maxmium of 100, a value of 0 and an extent of 10.   */  public JScrollBar()  {    this(SwingConstants.VERTICAL, 0, 10, 0, 100);  }  /**   * Creates a new JScrollBar object with a minimum of 0, a    * maximum of 100, a value of 0, an extent of 10 and the given   * orientation.   *   * @param orientation The orientation of the JScrollBar.   */  public JScrollBar(int orientation)  {    this(orientation, 0, 10, 0, 100);  }  /**   * Creates a new JScrollBar object with the given orientation,    * value, min, max, and extent.   *   * @param orientation The orientation to use.   * @param value The value to use.   * @param extent The extent to use.   * @param min The minimum value of the scrollbar.   * @param max The maximum value of the scrollbar.   */  public JScrollBar(int orientation, int value, int extent, int min, int max)  {    model = new DefaultBoundedRangeModel(value, extent, min, max);    if (orientation != SwingConstants.HORIZONTAL        && orientation != SwingConstants.VERTICAL)      throw new IllegalArgumentException(orientation                                         + " is not a legal orientation");    this.orientation = orientation;    updateUI();  }  /**   * This method sets the UI of this scrollbar to   * the given UI.   *   * @param ui The UI to use with this scrollbar.   */  public void setUI(ScrollBarUI ui)  {    super.setUI(ui);  }  /**   * This method returns the UI that is being used   * with this scrollbar.   *   * @return The scrollbar's current UI.   */  public ScrollBarUI getUI()  {    return (ScrollBarUI) ui;  }  /**   * This method changes the UI to be the   * default for the current look and feel.   */  public void updateUI()  {    setUI((ScrollBarUI) UIManager.getUI(this));    invalidate();    repaint();  }  /**   * This method returns an identifier to    * choose the correct UI delegate for the   * scrollbar.   *   * @return The identifer to choose the UI delegate; "ScrollBarUI"   */  public String getUIClassID()  {    return "ScrollBarUI";  }  /**   * This method returns the orientation of the scrollbar.   *   * @return The orientation of the scrollbar.   */  public int getOrientation()  {    return orientation;  }  /**   * This method sets the orientation of the scrollbar.   *   * @param orientation The orientation of the scrollbar.   */  public void setOrientation(int orientation)  {    if (orientation != SwingConstants.HORIZONTAL        && orientation != SwingConstants.VERTICAL)      throw new IllegalArgumentException("orientation must be one of HORIZONTAL or VERTICAL");    if (orientation != this.orientation)      {	int oldOrientation = this.orientation;	this.orientation = orientation;	firePropertyChange("orientation", oldOrientation,	                   this.orientation);      }  }  /**   * This method returns the model being used with    * the scrollbar.   *   * @return The scrollbar's model.   */  public BoundedRangeModel getModel()  {    return model;  }  /**   * This method sets the model to use with   * the scrollbar.   *   * @param newModel The new model to use with the scrollbar.   */  public void setModel(BoundedRangeModel newModel)  {    if (model != newModel)      {	BoundedRangeModel oldModel = model;	model = newModel;	firePropertyChange("model", oldModel, model);      }  }  /**   * This method returns how much the scrollbar's value   * should change for a unit increment depending on the    * given direction.   *   * @param direction The direction to scroll in.   *   * @return The amount the scrollbar's value will change given the direction.   */  public int getUnitIncrement(int direction)  {    return direction * unitIncrement;  }  /**   * This method sets the unitIncrement property.

⌨️ 快捷键说明

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