public class JScrollPane extends JComponentimplements ScrollPaneConstants , Accessible
JScrollPane manages a viewport, optional vertical and horizontal scroll bars, and optional row and column heading viewports. You can find task-oriented documentation of
JScrollPane in
How to Use Scroll Panes, a section in
The Java Tutorial. Note that
JScrollPane does not support heavyweight components.
|
|
JViewport provides a window, or "viewport" onto a data source -- for example, a text file. That data source is the "scrollable client" (aka data model) displayed by the
JViewport view. A
JScrollPane basically consists of
JScrollBars, a
JViewport, and the wiring between them, as shown in the diagram at right.
In addition to the scroll bars and viewport, a JScrollPane can have a column header and a row header. Each of these is a JViewport object that you specify with setRowHeaderView, and setColumnHeaderView. The column header viewport automatically scrolls left and right, tracking the left-right scrolling of the main viewport. (It never scrolls vertically, however.) The row header acts in a similar fashion.
Where two scroll bars meet, the row header meets the column header, or a scroll bar meets one of the headers, both components stop short of the corner, leaving a rectangular space which is, by default, empty. These spaces can potentially exist in any number of the four corners. In the previous diagram, the top right space is present and identified by the label "corner component".
Any number of these empty spaces can be replaced by using the setCorner method to add a component to a particular corner. (Note: The same component cannot be added to multiple corners.) This is useful if there's some extra decoration or function you'd like to add to the scroll pane. The size of each corner component is entirely determined by the size of the headers and/or scroll bars that surround it.
A corner component will only be visible if there is an empty space in that corner for it to exist in. For example, consider a component set into the top right corner of a scroll pane with a column header. If the scroll pane's vertical scrollbar is not present, perhaps because the view component hasn't grown large enough to require it, then the corner component will not be shown (since there is no empty space in that corner created by the meeting of the header and vertical scroll bar). Forcing the scroll bar to always be shown, using setVerticalScrollBarPolicy(VERTICAL_SCROLLBAR_ALWAYS), will ensure that the space for the corner component always exists.
To add a border around the main viewport, you can use setViewportBorder. (Of course, you can also add a border around the whole scroll pane using setBorder.)
A common operation to want to do is to set the background color that will be used if the main viewport view is smaller than the viewport, or is not opaque. This can be accomplished by setting the background color of the viewport, via scrollPane.getViewport().setBackground(). The reason for setting the color of the viewport and not the scrollpane is that by default JViewport is opaque which, among other things, means it will completely fill in its background using its background color. Therefore when JScrollPane draws its background the viewport will usually draw over it.
By default JScrollPane uses ScrollPaneLayout to handle the layout of its child Components. ScrollPaneLayout determines the size to make the viewport view in one of two ways:
Scrollable a combination of getPreferredScrollableViewportSize, getScrollableTracksViewportWidth and getScrollableTracksViewportHeightis used, otherwise getPreferredSize is used. Warning: Swing is not thread safe. For more information see Swing's Threading Policy.
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.
JScrollBar,
JViewport,
ScrollPaneLayout,
Scrollable,
Component.getPreferredSize() ,
setViewportView(java.awt.Component),
setRowHeaderView(java.awt.Component),
setColumnHeaderView(java.awt.Component),
setCorner(java.lang.String, java.awt.Component),
setViewportBorder(javax.swing.border.Border)
| Modifier and Type | Class and Description |
|---|---|
protected class |
JScrollPane
This class implements accessibility support for the
JScrollPane class.
|
protected class |
JScrollPane
By default
JScrollPane creates scrollbars that are instances of this class.
|
JComponent.AccessibleJComponent Container.AccessibleAWTContainer Component.AccessibleAWTComponent , Component.BaselineResizeBehavior , Component.BltBufferStrategy , Component.FlipBufferStrategy | Modifier and Type | Field and Description |
|---|---|
protected JViewport |
columnHeader
The column header child.
|
protected JScrollBar |
horizontalScrollBar
The scrollpane's horizontal scrollbar child.
|
protected int |
horizontalScrollBarPolicy
The display policy for the horizontal scrollbar.
|
protected Component |
lowerLeft
The component to display in the lower left corner.
|
protected Component |
lowerRight
The component to display in the lower right corner.
|
protected JViewport |
rowHeader
The row header child.
|
protected Component |
upperLeft
The component to display in the upper left corner.
|
protected Component |
upperRight
The component to display in the upper right corner.
|
protected JScrollBar |
verticalScrollBar
The scrollpane's vertical scrollbar child.
|
protected int |
verticalScrollBarPolicy
The display policy for the vertical scrollbar.
|
protected JViewport |
viewport
The scrollpane's viewport child.
|
listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOWaccessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENTCOLUMN_HEADER, HORIZONTAL_SCROLLBAR, HORIZONTAL_SCROLLBAR_ALWAYS, HORIZONTAL_SCROLLBAR_AS_NEEDED, HORIZONTAL_SCROLLBAR_NEVER, HORIZONTAL_SCROLLBAR_POLICY, LOWER_LEADING_CORNER, LOWER_LEFT_CORNER, LOWER_RIGHT_CORNER, LOWER_TRAILING_CORNER, ROW_HEADER, UPPER_LEADING_CORNER, UPPER_LEFT_CORNER, UPPER_RIGHT_CORNER, UPPER_TRAILING_CORNER, VERTICAL_SCROLLBAR, VERTICAL_SCROLLBAR_ALWAYS, VERTICAL_SCROLLBAR_AS_NEEDED, VERTICAL_SCROLLBAR_NEVER, VERTICAL_SCROLLBAR_POLICY, VIEWPORTABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH| Constructor and Description |
|---|
JScrollPane()
Creates an empty (no viewport view)
JScrollPane where both horizontal and vertical scrollbars appear when needed.
|
JScrollPane(Component
Creates a
JScrollPane that displays the contents of the specified component, where both horizontal and vertical scrollbars appear whenever the component's contents are larger than the view.
|
JScrollPane(Component
Creates a
JScrollPane that displays the view component in a viewport whose view position can be controlled with a pair of scrollbars.
|
JScrollPane(int vsbPolicy, int hsbPolicy)
Creates an empty (no viewport view)
JScrollPane with specified scrollbar policies.
|
| Modifier and Type | Method and Description |
|---|---|
JScrollBar |
createHorizontalScrollBar()
Returns a
JScrollPane.ScrollBar by default.
|
JScrollBar |
createVerticalScrollBar()
Returns a
JScrollPane.ScrollBar by default.
|
protected JViewport |
createViewport()
Returns a new
JViewport by default.
|
AccessibleContext |
getAccessibleContext()
Gets the AccessibleContext associated with this JScrollPane.
|
JViewport |
getColumnHeader()
Returns the column header.
|
Component |
getCorner(String
Returns the component at the specified corner.
|
JScrollBar |
getHorizontalScrollBar()
Returns the horizontal scroll bar that controls the viewport's horizontal view position.
|
int |
getHorizontalScrollBarPolicy()
Returns the horizontal scroll bar policy value.
|
JViewport |
getRowHeader()
Returns the row header.
|
ScrollPaneUI |
getUI()
Returns the look and feel (L&F) object that renders this component.
|
String |
getUIClassID()
Returns the suffix used to construct the name of the L&F class used to render this component.
|
JScrollBar |
getVerticalScrollBar()
Returns the vertical scroll bar that controls the viewports vertical view position.
|
int |
getVerticalScrollBarPolicy()
Returns the vertical scroll bar policy value.
|
JViewport |
getViewport()
Returns the current
JViewport.
|
Border |
getViewportBorder()
Returns the
Border object that surrounds the viewport.
|
Rectangle |
getViewportBorderBounds()
Returns the bounds of the viewport's border.
|
boolean |
isValidateRoot()
Overridden to return true so that any calls to
revalidate on any descendants of this
JScrollPane will cause the entire tree beginning with this
JScrollPane to be validated.
|
boolean |
isWheelScrollingEnabled()
Indicates whether or not scrolling will take place in response to the mouse wheel.
|
protected String |
paramString()
Returns a string representation of this
JScrollPane.
|
void |
setColumnHeader(JViewport
Removes the old columnHeader, if it exists; if the new columnHeader isn't
null, syncs the x coordinate of its viewPosition with the viewport (if there is one) and then adds it to the scroll pane.
|
void |
setColumnHeaderView(Component
Creates a column-header viewport if necessary, sets its view, and then adds the column-header viewport to the scrollpane.
|
void |
setComponentOrientation(ComponentOrientation
Sets the orientation for the vertical and horizontal scrollbars as determined by the
ComponentOrientation argument.
|
void |
setCorner(String
Adds a child that will appear in one of the scroll panes corners, if there's room.
|
void |
setHorizontalScrollBar(JScrollBar
Adds the scrollbar that controls the viewport's horizontal view position to the scrollpane.
|
void |
setHorizontalScrollBarPolicy(int policy)
Determines when the horizontal scrollbar appears in the scrollpane.
|
void |
setLayout(LayoutManager
Sets the layout manager for this
JScrollPane.
|
void |
setRowHeader(JViewport
Removes the old rowHeader, if it exists; if the new rowHeader isn't
null, syncs the y coordinate of its viewPosition with the viewport (if there is one) and then adds it to the scroll pane.
|
void |
setRowHeaderView(Component
Creates a row-header viewport if necessary, sets its view and then adds the row-header viewport to the scrollpane.
|
void |
setUI(ScrollPaneUI
Sets the
ScrollPaneUI object that provides the look and feel (L&F) for this component.
|
void |
setVerticalScrollBar(JScrollBar
Adds the scrollbar that controls the viewports vertical view position to the scrollpane.
|
void |
setVerticalScrollBarPolicy(int policy)
Determines when the vertical scrollbar appears in the scrollpane.
|
void |
setViewport(JViewport
Removes the old viewport (if there is one); forces the viewPosition of the new viewport to be in the +x,+y quadrant; syncs up the row and column headers (if there are any) with the new viewport; and finally syncs the scrollbars and headers with the new viewport.
|
void |
setViewportBorder(Border
Adds a border around the viewport.
|
void |
setViewportView(Component
Creates a viewport if necessary and then sets its view.
|
void |
setWheelScrollingEnabled(boolean handleWheel)
Enables/disables scrolling in response to movement of the mouse wheel.
|
void |
updateUI()
Replaces the current
ScrollPaneUI object with a version from the current default look and feel.
|
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, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, 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, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, 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, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, 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, 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, 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, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycleprotected int verticalScrollBarPolicy
ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED.
setVerticalScrollBarPolicy(int)
protected int horizontalScrollBarPolicy
ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED.
setHorizontalScrollBarPolicy(int)
protected JViewportviewport
JViewport.
setViewport(javax.swing.JViewport)
protected JScrollBarverticalScrollBar
JScrollBar.
protected JScrollBarhorizontalScrollBar
JScrollBar.
protected JViewportrowHeader
null.
setRowHeader(javax.swing.JViewport)
protected JViewportcolumnHeader
null.
setColumnHeader(javax.swing.JViewport)
protected ComponentlowerLeft
null.
protected ComponentlowerRight
null.
protected ComponentupperLeft
null.
protected ComponentupperRight
null.
public JScrollPane(Componentview, int vsbPolicy, int hsbPolicy)
JScrollPane that displays the view component in a viewport whose view position can be controlled with a pair of scrollbars. The scrollbar policies specify when the scrollbars are displayed, For example, if
vsbPolicy is
VERTICAL_SCROLLBAR_AS_NEEDED then the vertical scrollbar only appears if the view doesn't fit vertically. The available policy settings are listed at
setVerticalScrollBarPolicy(int) and
setHorizontalScrollBarPolicy(int).
view - the component to display in the scrollpanes viewport
vsbPolicy - an integer that specifies the vertical scrollbar policy
hsbPolicy - an integer that specifies the horizontal scrollbar policy
setViewportView(java.awt.Component)
public JScrollPane(Componentview)
JScrollPane that displays the contents of the specified component, where both horizontal and vertical scrollbars appear whenever the component's contents are larger than the view.
view - the component to display in the scrollpane's viewport
setViewportView(java.awt.Component)
public JScrollPane(int vsbPolicy,
int hsbPolicy)
JScrollPane with specified scrollbar policies. The available policy settings are listed at
setVerticalScrollBarPolicy(int) and
setHorizontalScrollBarPolicy(int).
vsbPolicy - an integer that specifies the vertical scrollbar policy
hsbPolicy - an integer that specifies the horizontal scrollbar policy
setViewportView(java.awt.Component)
public JScrollPane()
JScrollPane where both horizontal and vertical scrollbars appear when needed.
public ScrollPaneUIgetUI()
ScrollPaneUI object that renders this component
setUI(javax.swing.plaf.ScrollPaneUI)
public void setUI(ScrollPaneUIui)
ScrollPaneUI object that provides the look and feel (L&F) for this component.
ui - the
ScrollPaneUI L&F object
getUI()
public void updateUI()
ScrollPaneUI object with a version from the current default look and feel. To be called when the default look and feel changes.
updateUI in class
JComponent
JComponent.updateUI() ,
UIManager.getUI(javax.swing.JComponent)
public StringgetUIClassID()
getUIClassID in class
JComponent
JComponent.getUIClassID() ,
UIDefaults.getUI(javax.swing.JComponent)
public void setLayout(LayoutManagerlayout)
JScrollPane. This method overrides
setLayout in
java.awt.Container to ensure that only
LayoutManagers which are subclasses of
ScrollPaneLayout can be used in a
JScrollPane. If
layout is non-null, this will invoke
syncWithScrollPane on it.
setLayout in class
Container
layout - the specified layout manager
ClassCastException - if layout is not a
ScrollPaneLayout
Container.getLayout() ,
Container.setLayout(java.awt.LayoutManager)
public boolean isValidateRoot()
revalidate on any descendants of this
JScrollPane will cause the entire tree beginning with this
JScrollPane to be validated.
isValidateRoot in class
JComponent
Container.validate() ,
JComponent.revalidate() ,
JComponent.isValidateRoot() ,
Container.isValidateRoot()
public int getVerticalScrollBarPolicy()
verticalScrollBarPolicy property
setVerticalScrollBarPolicy(int)
public void setVerticalScrollBarPolicy(int policy)
ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED ScrollPaneConstants.VERTICAL_SCROLLBAR_NEVER ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS policy - one of the three values listed above
IllegalArgumentException - if
policy is not one of the legal values shown above
getVerticalScrollBarPolicy()
public int getHorizontalScrollBarPolicy()
horizontalScrollBarPolicy property
setHorizontalScrollBarPolicy(int)
public void setHorizontalScrollBarPolicy(int policy)
ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS policy - one of the three values listed above
IllegalArgumentException - if
policy is not one of the legal values shown above
getHorizontalScrollBarPolicy()
public BordergetViewportBorder()
Border object that surrounds the viewport.
viewportBorder property
setViewportBorder(javax.swing.border.Border)
public void setViewportBorder(BorderviewportBorder)
JViewport doesn't support the
JComponent border property. Similarly setting the
JScrollPanes viewport doesn't affect the
viewportBorder property.
The default value of this property is computed by the look and feel implementation.
viewportBorder - the border to be added
getViewportBorder(),
setViewport(javax.swing.JViewport)
public RectanglegetViewportBorderBounds()
Rectangle object specifying the viewport border
public JScrollBarcreateHorizontalScrollBar()
JScrollPane.ScrollBar by default. Subclasses may override this method to force
ScrollPaneUI implementations to use a
JScrollBar subclass. Used by
ScrollPaneUI implementations to create the horizontal scrollbar.
JScrollBar with a horizontal orientation
JScrollBar
public JScrollBargetHorizontalScrollBar()
horizontalScrollBar property
setHorizontalScrollBar(javax.swing.JScrollBar)
public void setHorizontalScrollBar(JScrollBarhorizontalScrollBar)
JScrollPane creates horizontal and vertical scrollbars by default.
horizontalScrollBar - the horizontal scrollbar to be added
createHorizontalScrollBar(),
getHorizontalScrollBar()
public JScrollBarcreateVerticalScrollBar()
JScrollPane.ScrollBar by default. Subclasses may override this method to force
ScrollPaneUI implementations to use a
JScrollBar subclass. Used by
ScrollPaneUI implementations to create the vertical scrollbar.
JScrollBar with a vertical orientation
JScrollBar
public JScrollBargetVerticalScrollBar()
verticalScrollBar property
setVerticalScrollBar(javax.swing.JScrollBar)
public void setVerticalScrollBar(JScrollBarverticalScrollBar)
JScrollPane creates vertical and horizontal scrollbars by default.
verticalScrollBar - the new vertical scrollbar to be added
createVerticalScrollBar(),
getVerticalScrollBar()
protected JViewportcreateViewport()
JViewport by default. Used to create the viewport (as needed) in
setViewportView,
setRowHeaderView, and
setColumnHeaderView. Subclasses may override this method to return a subclass of
JViewport.
JViewport
public JViewportgetViewport()
JViewport.
viewport property
setViewport(javax.swing.JViewport)
public void setViewport(JViewportviewport)
Most applications will find it more convenient to use setViewportView to add a viewport and a view to the scrollpane.
viewport - the new viewport to be used; if viewport is
null, the old viewport is still removed and the new viewport is set to
null
createViewport(),
getViewport(),
setViewportView(java.awt.Component)
public void setViewportView(Componentview)
JScrollPane constructor should use this method to specify the scrollable child that's going to be displayed in the scrollpane. For example:
JScrollPane scrollpane = new JScrollPane(); scrollpane.setViewportView(myBigComponentToScroll);Applications should not add children directly to the scrollpane.
view - the component to add to the viewport
setViewport(javax.swing.JViewport),
JViewport.setView(java.awt.Component)
public JViewportgetRowHeader()
rowHeader property
setRowHeader(javax.swing.JViewport)
public void setRowHeader(JViewportrowHeader)
null, syncs the y coordinate of its viewPosition with the viewport (if there is one) and then adds it to the scroll pane.
Most applications will find it more convenient to use setRowHeaderView to add a row header component and its viewport to the scroll pane.
rowHeader - the new row header to be used; if
null the old row header is still removed and the new rowHeader is set to
null
getRowHeader(),
setRowHeaderView(java.awt.Component)
public void setRowHeaderView(Componentview)
JScrollPane scrollpane = new JScrollPane(); scrollpane.setViewportView(myBigComponentToScroll); scrollpane.setRowHeaderView(myBigComponentsRowHeader);
view - the component to display as the row header
setRowHeader(javax.swing.JViewport),
JViewport.setView(java.awt.Component)
public JViewportgetColumnHeader()
columnHeader property
setColumnHeader(javax.swing.JViewport)
public void setColumnHeader(JViewportcolumnHeader)
null, syncs the x coordinate of its viewPosition with the viewport (if there is one) and then adds it to the scroll pane.
Most applications will find it more convenient to use setColumnHeaderView to add a column header component and its viewport to the scroll pane.
public void setColumnHeaderView(Componentview)
JScrollPane scrollpane = new JScrollPane(); scrollpane.setViewportView(myBigComponentToScroll); scrollpane.setColumnHeaderView(myBigComponentsColumnHeader);
view - the component to display as the column header
setColumnHeader(javax.swing.JViewport),
JViewport.setView(java.awt.Component)
public ComponentgetCorner(String key)
key value specifying the corner is one of:
key - one of the values as shown above
null) identified by the given key, or
null if the key is invalid
setCorner(java.lang.String, java.awt.Component)
public void setCorner(Stringkey, Component corner)
Although "corner" doesn't match any beans property signature, PropertyChange events are generated with the property name set to the corner key.
key - identifies which corner the component will appear in
corner - one of the following components:
IllegalArgumentException - if corner key is invalid
public void setComponentOrientation(ComponentOrientationco)
ComponentOrientation argument.
setComponentOrientation in class
Component
co - one of the following values:
ComponentOrientation
public boolean isWheelScrollingEnabled()
setWheelScrollingEnabled(boolean)
public void setWheelScrollingEnabled(boolean handleWheel)
handleWheel -
true if scrolling should be done automatically for a MouseWheelEvent,
false otherwise.
isWheelScrollingEnabled(),
MouseWheelEvent,
MouseWheelListener
protected StringparamString()
JScrollPane. This method is intended to be used only for debugging purposes, and the content and format of the returned string may vary between implementations. The returned string may be empty but may not be
null.
paramString in class
JComponent
JScrollPane.
public AccessibleContextgetAccessibleContext()
getAccessibleContext in interface
Accessible
getAccessibleContext in class
Component