public class JScrollBar extends JComponent implements Adjustable, Accessible
| Modifier and Type | Class and Description |
|---|---|
protected class |
JScrollBar.AccessibleJScrollBar
Provides the accessibility features for the
JScrollBar
component. |
JComponent.AccessibleJComponentContainer.AccessibleAWTContainerComponent.AccessibleAWTComponent, Component.BltBufferStrategy, Component.FlipBufferStrategy| Modifier and Type | Field and Description |
|---|---|
protected int |
blockIncrement
How much the thumb moves when moving in a block.
|
protected BoundedRangeModel |
model
The model that holds the scroll bar's data.
|
protected int |
orientation
The orientation of the scroll bar.
|
protected int |
unitIncrement
How much the thumb moves when moving in a unit.
|
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOWBOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENTHORIZONTAL, NO_ORIENTATION, VERTICALABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH| Constructor and Description |
|---|
JScrollBar()
Creates a new horizontal JScrollBar object with a minimum
of 0, a maxmium of 100, a value of 0 and an extent of 10.
|
JScrollBar(int orientation)
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.
|
JScrollBar(int orientation,
int value,
int extent,
int min,
int max)
Creates a new JScrollBar object with the given orientation,
value, min, max, and extent.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addAdjustmentListener(AdjustmentListener listener)
This method adds an AdjustmentListener to the scroll bar.
|
protected void |
fireAdjustmentValueChanged(int id,
int type,
int value)
This method is called to fired AdjustmentEvents to the listeners
of this scroll bar.
|
AccessibleContext |
getAccessibleContext()
Returns the object that provides accessibility features for this
JScrollBar component. |
AdjustmentListener[] |
getAdjustmentListeners()
This method returns an arry of all AdjustmentListeners listening to
this scroll bar.
|
int |
getBlockIncrement()
This method returns the blockIncrement.
|
int |
getBlockIncrement(int direction)
The method returns how much the scrollbar's value
should change for a block increment depending on
the given direction.
|
int |
getMaximum()
This method returns the maximum value of the scrollbar.
|
Dimension |
getMaximumSize()
This method returns the maximum size for this scroll bar.
|
int |
getMinimum()
This method returns the minimum value of the scrollbar.
|
Dimension |
getMinimumSize()
This method returns the minimum size for this scroll bar.
|
BoundedRangeModel |
getModel()
This method returns the model being used with
the scrollbar.
|
int |
getOrientation()
This method returns the orientation of the scrollbar.
|
ScrollBarUI |
getUI()
This method returns the UI that is being used
with this scrollbar.
|
String |
getUIClassID()
This method returns an identifier to
choose the correct UI delegate for the
scrollbar.
|
int |
getUnitIncrement()
This method returns the unitIncrement.
|
int |
getUnitIncrement(int direction)
This method returns how much the scrollbar's value
should change for a unit increment depending on the
given direction.
|
int |
getValue()
This method returns the value of the scrollbar.
|
boolean |
getValueIsAdjusting()
This method returns the model's isAjusting value.
|
int |
getVisibleAmount()
This method returns the visible amount (AKA extent).
|
protected String |
paramString()
Returns a string describing the attributes for the
JScrollBar
component, for use in debugging. |
void |
removeAdjustmentListener(AdjustmentListener listener)
This method removes an AdjustmentListener from the scroll bar.
|
void |
setBlockIncrement(int blockIncrement)
This method sets the blockIncrement property.
|
void |
setEnabled(boolean x)
This method overrides the setEnabled in JComponent.
|
void |
setMaximum(int maximum)
This method sets the maximum value of the scrollbar.
|
void |
setMinimum(int minimum)
This method sets the minimum value of the scrollbar.
|
void |
setModel(BoundedRangeModel newModel)
This method sets the model to use with
the scrollbar.
|
void |
setOrientation(int orientation)
This method sets the orientation of the scrollbar.
|
void |
setUI(ScrollBarUI ui)
This method sets the UI of this scrollbar to
the given UI.
|
void |
setUnitIncrement(int unitIncrement)
This method sets the unitIncrement property.
|
void |
setValue(int value)
This method changes the value of the scrollbar.
|
void |
setValueIsAdjusting(boolean b)
This method sets the model's isAdjusting value.
|
void |
setValues(int newValue,
int newExtent,
int newMin,
int newMax)
This method sets the value, extent, minimum and
maximum.
|
void |
setVisibleAmount(int extent)
This method sets the visible amount (AKA extent).
|
void |
updateUI()
This method changes the UI to be the
default for the current look and feel.
|
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getNextFocusableComponent, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, 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, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setNextFocusableComponent, setOpaque, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, updateadd, 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, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusDownCycle, validate, validateTreeaction, 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, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, 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, processMouseEvent, 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, setMaximumSize, setMinimumSize, setName, setPreferredSize, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycleprotected int blockIncrement
protected BoundedRangeModel model
protected int orientation
protected int unitIncrement
public JScrollBar()
public JScrollBar(int orientation)
orientation - The orientation of the JScrollBar.public JScrollBar(int orientation, int value, int extent, int min, int max)
orientation - The orientation to use.value - The value to use.extent - The extent to use.min - The minimum value of the scrollbar.max - The maximum value of the scrollbar.public void setUI(ScrollBarUI ui)
ui - The UI to use with this scrollbar.public ScrollBarUI getUI()
public void updateUI()
updateUI in class JComponentpublic String getUIClassID()
getUIClassID in class JComponentJComponent.setUI(javax.swing.plaf.ComponentUI),
JComponent.updateUI()public int getOrientation()
getOrientation in interface AdjustableAdjustable.HORIZONTAL,
Adjustable.VERTICAL,
Adjustable.NO_ORIENTATIONpublic void setOrientation(int orientation)
orientation - The orientation of the scrollbar.public BoundedRangeModel getModel()
public void setModel(BoundedRangeModel newModel)
newModel - The new model to use with the scrollbar.public int getUnitIncrement(int direction)
direction - The direction to scroll in.public void setUnitIncrement(int unitIncrement)
setUnitIncrement in interface AdjustableunitIncrement - The new unitIncrement.public int getBlockIncrement(int direction)
direction - The direction to scroll in.public void setBlockIncrement(int blockIncrement)
setBlockIncrement in interface AdjustableblockIncrement - The new blockIncrement.public int getUnitIncrement()
getUnitIncrement in interface Adjustablepublic int getBlockIncrement()
getBlockIncrement in interface Adjustablepublic int getValue()
getValue in interface Adjustablepublic void setValue(int value)
setValue in interface Adjustablevalue - The new value of the scrollbar.public int getVisibleAmount()
getVisibleAmount in interface Adjustablepublic void setVisibleAmount(int extent)
setVisibleAmount in interface Adjustableextent - The visible amount (AKA extent).public int getMinimum()
getMinimum in interface Adjustablepublic void setMinimum(int minimum)
setMinimum in interface Adjustableminimum - The minimum value of the scrollbar.public int getMaximum()
getMaximum in interface Adjustablepublic void setMaximum(int maximum)
setMaximum in interface Adjustablemaximum - The maximum value of the scrollbar.public boolean getValueIsAdjusting()
public void setValueIsAdjusting(boolean b)
b - The new isAdjusting value.public void setValues(int newValue, int newExtent, int newMin, int newMax)
newValue - The new value.newExtent - The new extent.newMin - The new minimum.newMax - The new maximum.public void addAdjustmentListener(AdjustmentListener listener)
addAdjustmentListener in interface Adjustablelistener - The listener to add.AdjustmentEventpublic void removeAdjustmentListener(AdjustmentListener listener)
removeAdjustmentListener in interface Adjustablelistener - The listener to remove.AdjustmentEventpublic AdjustmentListener[] getAdjustmentListeners()
protected void fireAdjustmentValueChanged(int id, int type, int value)
id - The ID of the adjustment event.type - The Type of change.value - The new value for the property that was changed..public Dimension getMinimumSize()
getMinimumSize in class JComponentComponent.setMinimumSize(java.awt.Dimension),
Component.getMinimumSize(),
Component.isMinimumSizeSet(),
ComponentUI.getMinimumSize(JComponent)public Dimension getMaximumSize()
getMaximumSize in class JComponentComponent.setMaximumSize(java.awt.Dimension),
Component.getMaximumSize(),
Component.isMaximumSizeSet(),
ComponentUI.getMaximumSize(JComponent)public void setEnabled(boolean x)
setEnabled in class JComponentx - Whether the scrollbar is enabled.Component.isEnabled(),
Component.isLightweight()protected String paramString()
JScrollBar
component, for use in debugging. The return value is guaranteed to be
non-null, but the format of the string may vary between
implementations.paramString in class JComponentJScrollBar.public AccessibleContext getAccessibleContext()
JScrollBar component.getAccessibleContext in interface AccessiblegetAccessibleContext in class JComponentJScrollBar.AccessibleJScrollBar).