JavaTM Platform
Standard Ed. 6

javax.swing
类 JScrollPane.ScrollBar

java.lang.Object
  继承者 java.awt.Component
      继承者 java.awt.Container
          继承者 javax.swing.JComponent
              继承者 javax.swing.JScrollBar
                  继承者 javax.swing.JScrollPane.ScrollBar
所有已实现的接口:
Adjustable, ImageObserver, MenuContainer, Serializable, Accessible, UIResource
正在封闭类:
JScrollPane

protected class JScrollPane.ScrollBar
extends JScrollBar
implements UIResource

默认情况下,JScrollPane 创建的滚动条为此类的实例。Scrollbar 重写 getUnitIncrementgetBlockIncrement 方法,所以如果视口的视图为 Scrollable,会要求该视图计算这些值。除非显式设置了单位/块增量。

警告:此类的序列化对象将与以后的 Swing 版本不兼容。当前的序列化支持适用于短期存储或运行相同 Swing 版本的应用程序之间的 RMI。从 1.4 版本开始,已在 java.beans 包中添加了支持所有 JavaBeansTM 长期存储的功能。请参阅 XMLEncoder

另请参见:
Scrollable, JScrollPane.createVerticalScrollBar(), JScrollPane.createHorizontalScrollBar()

嵌套类摘要
 
从类 javax.swing.JScrollBar 继承的嵌套类/接口
JScrollBar.AccessibleJScrollBar
 
从类 javax.swing.JComponent 继承的嵌套类/接口
JComponent.AccessibleJComponent
 
从类 java.awt.Container 继承的嵌套类/接口
Container.AccessibleAWTContainer
 
从类 java.awt.Component 继承的嵌套类/接口
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy
 
字段摘要
 
从类 javax.swing.JScrollBar 继承的字段
blockIncrement, model, orientation, unitIncrement
 
从类 javax.swing.JComponent 继承的字段
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
 
从类 java.awt.Component 继承的字段
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
从接口 java.awt.Adjustable 继承的字段
HORIZONTAL, NO_ORIENTATION, VERTICAL
 
从接口 java.awt.image.ImageObserver 继承的字段
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
构造方法摘要
JScrollPane.ScrollBar(int orientation)
          创建具有指定方向的滚动条。
 
方法摘要
 int getBlockIncrement(int direction)
          如果视口中的视图为 Scrollable 对象,将计算滚动的块增量值。
 int getUnitIncrement(int direction)
          如果视口中的视图为 Scrollable 对象,将计算滚动的单位增量值。
 void setBlockIncrement(int blockIncrement)
          通知超类来设定该值,并将 blockIncrementSet 实例变量重置为 true。
 void setUnitIncrement(int unitIncrement)
          通知超类来设定该值,并将 unitIncrementSet 实例变量重置为 true。
 
从类 javax.swing.JScrollBar 继承的方法
addAdjustmentListener, fireAdjustmentValueChanged, getAccessibleContext, getAdjustmentListeners, getBlockIncrement, getMaximum, getMaximumSize, getMinimum, getMinimumSize, getModel, getOrientation, getUI, getUIClassID, getUnitIncrement, getValue, getValueIsAdjusting, getVisibleAmount, paramString, removeAdjustmentListener, setEnabled, setMaximum, setMinimum, setModel, setOrientation, setUI, setValue, setValueIsAdjusting, setValues, setVisibleAmount, updateUI
 
从类 javax.swing.JComponent 继承的方法
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
 
从类 java.awt.Container 继承的方法
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusBackward, transferFocusDownCycle, validate, validateTree
 
从类 java.awt.Component 继承的方法
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusUpCycle
 
从类 java.lang.Object 继承的方法
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

构造方法详细信息

JScrollPane.ScrollBar

public JScrollPane.ScrollBar(int orientation)
创建具有指定方向的滚动条。方向包括:

参数:
orientation - 指定上面两个合法方向值之一的整数
方法详细信息

setUnitIncrement

public void setUnitIncrement(int unitIncrement)
通知超类来设定该值,并将 unitIncrementSet 实例变量重置为 true。

指定者:
接口 Adjustable 中的 setUnitIncrement
覆盖:
JScrollBar 中的 setUnitIncrement
参数:
unitIncrement - 新单位增量值,以像素为单位
从以下版本开始:
1.4
另请参见:
JScrollBar.getUnitIncrement(int)

getUnitIncrement

public int getUnitIncrement(int direction)
如果视口中的视图为 Scrollable 对象,将计算滚动的单位增量值。否则返回 super.getUnitIncrement

覆盖:
JScrollBar 中的 getUnitIncrement
参数:
direction - 小于零表示向上/左滚动,大于零表示向下/右滚动
返回:
包含单位增量的整数,以像素为单位
另请参见:
Scrollable.getScrollableUnitIncrement(java.awt.Rectangle, int, int)

setBlockIncrement

public void setBlockIncrement(int blockIncrement)
通知超类来设定该值,并将 blockIncrementSet 实例变量重置为 true。

指定者:
接口 Adjustable 中的 setBlockIncrement
覆盖:
JScrollBar 中的 setBlockIncrement
参数:
blockIncrement - 新的块增量值,以像素为单位
另请参见:
JScrollBar.getBlockIncrement()

getBlockIncrement

public int getBlockIncrement(int direction)
如果视口中的视图为 Scrollable 对象,将计算滚动的块增量值。否则 blockIncrement 与视口的宽度或高度相等。如果无任何视口,则返回 super.getBlockIncrement

覆盖:
JScrollBar 中的 getBlockIncrement
参数:
direction - 小于零表示向上/向左滚动,大于零表示向下/向右滚动
返回:
包含块增量的整数,以像素为单位
另请参见:
Scrollable.getScrollableBlockIncrement(java.awt.Rectangle, int, int)

JavaTM Platform
Standard Ed. 6

提交错误或意见
有关更多的 API 参考资料和开发人员文档,请参阅 Java SE 开发人员文档。该文档包含更详细的、面向开发人员的描述,以及总体概述、术语定义、使用技巧和工作代码示例。

版权所有 2007 Sun Microsystems, Inc. 保留所有权利。 请遵守许可证条款。另请参阅文档重新分发政策