protected class JScrollPane.ScrollBar extends JScrollBar implements UIResource
By default JScrollPane
creates scrollbars that are instances of this class. Scrollbar
overrides the getUnitIncrement
and getBlockIncrement
methods so that, if the viewport's view is a Scrollable
, the view is asked to compute these values. Unless the unit/block increment have been explicitly set.
Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. As of 1.4, support for long term storage of all JavaBeans™ has been added to the java.beans
package. Please see XMLEncoder
.
Scrollable
, JScrollPane.createVerticalScrollBar()
, JScrollPane.createHorizontalScrollBar()
JScrollBar.AccessibleJScrollBar
JComponent.AccessibleJComponent
Container.AccessibleAWTContainer
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy
blockIncrement, model, orientation, unitIncrement
listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
accessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
HORIZONTAL, NO_ORIENTATION, VERTICAL
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
public ScrollBar(int orientation)
Creates a scrollbar with the specified orientation. The options are:
ScrollPaneConstants.VERTICAL
ScrollPaneConstants.HORIZONTAL
orientation
- an integer specifying one of the legal orientation values shown abovepublic void setUnitIncrement(int unitIncrement)
Messages super to set the value, and resets the unitIncrementSet
instance variable to true.
setUnitIncrement
in interface Adjustable
setUnitIncrement
in class JScrollBar
unitIncrement
- the new unit increment value, in pixelsJScrollBar.getUnitIncrement(int)
public int getUnitIncrement(int direction)
Computes the unit increment for scrolling if the viewport's view is a Scrollable
object. Otherwise return super.getUnitIncrement
.
getUnitIncrement
in class JScrollBar
direction
- less than zero to scroll up/left, greater than zero for down/rightScrollable.getScrollableUnitIncrement(java.awt.Rectangle, int, int)
public void setBlockIncrement(int blockIncrement)
Messages super to set the value, and resets the blockIncrementSet
instance variable to true.
setBlockIncrement
in interface Adjustable
setBlockIncrement
in class JScrollBar
blockIncrement
- the new block increment value, in pixelsJScrollBar.getBlockIncrement()
public int getBlockIncrement(int direction)
Computes the block increment for scrolling if the viewport's view is a Scrollable
object. Otherwise the blockIncrement
equals the viewport's width or height. If there's no viewport return super.getBlockIncrement
.
getBlockIncrement
in class JScrollBar
direction
- less than zero to scroll up/left, greater than zero for down/rightScrollable.getScrollableBlockIncrement(java.awt.Rectangle, int, int)
© 1993–2017, Oracle and/or its affiliates. All rights reserved.
Documentation extracted from Debian's OpenJDK Development Kit package.
Licensed under the GNU General Public License, version 2, with the Classpath Exception.
Various third party code in OpenJDK is licensed under different licenses (see Debian package).
Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.