javax.swing

Class JScrollPane

public class JScrollPane extends JComponent implements Accessible, ScrollPaneConstants

A component that embeds another component and enables it to be scrolled both in horizontal and vertical direction.
Property Stored in Bound?
columnHeader scrollPane yes
columnHeaderView columnHeader no
componentOrientation scrollPane yes
horizontalScrollBar scrollPane yes
horizontalScrollBarPolicy scrollPane yes
layout scrollPane yes
rowHeader scrollPane yes
rowHeaderView rowHeader no
validateRoot scrollPane no
verticalScrollBar scrollPane yes
verticalScrollBarPolicy scrollPane yes
viewport scrollPane yes
viewportBorder scrollPane yes
viewportBorderBounds scrollPane no
viewportView viewport no
wheelScrollingEnabled scrollPane yes
Nested Class Summary
protected classJScrollPane.AccessibleJScrollPane
Provides accessibility support for the JScrollPane.
protected classJScrollPane.ScrollBar
Field Summary
protected JViewportcolumnHeader
protected JScrollBarhorizontalScrollBar
protected inthorizontalScrollBarPolicy
protected ComponentlowerLeft
protected ComponentlowerRight
protected JViewportrowHeader
protected ComponentupperLeft
protected ComponentupperRight
protected JScrollBarverticalScrollBar
protected intverticalScrollBarPolicy
protected JViewportviewport
Constructor Summary
JScrollPane()
Creates a new JScrollPane without a view.
JScrollPane(Component view)
Creates a new JScrollPane that embeds the specified view component, displaying vertical and horizontal scrollbars as needed.
JScrollPane(int vsbPolicy, int hsbPolicy)
Creates a new JScrollPane without a view; The scrollbar policies are set to vsbPolicy and hsbPolicy.
JScrollPane(Component view, int vsbPolicy, int hsbPolicy)
Creates a new JScrollPane that embeds the specified view component; The scrollbar policies are set to vsbPolicy and hsbPolicy.
Method Summary
JScrollBarcreateHorizontalScrollBar()
JScrollBarcreateVerticalScrollBar()
protected JViewportcreateViewport()
AccessibleContextgetAccessibleContext()
Returns the accessible context associated with this JScrollPane.
JViewportgetColumnHeader()
ComponentgetCorner(String key)
JScrollBargetHorizontalScrollBar()
intgetHorizontalScrollBarPolicy()
JViewportgetRowHeader()
ScrollPaneUIgetUI()
This method returns the scrollpane's UI delegate.
StringgetUIClassID()
JScrollBargetVerticalScrollBar()
intgetVerticalScrollBarPolicy()
JViewportgetViewport()
BordergetViewportBorder()
RectanglegetViewportBorderBounds()
booleanisValidateRoot()
booleanisWheelScrollingEnabled()
voidsetColumnHeader(JViewport h)
voidsetColumnHeaderView(Component c)
voidsetComponentOrientation(ComponentOrientation co)
voidsetCorner(String key, Component c)
voidsetHorizontalScrollBar(JScrollBar h)
voidsetHorizontalScrollBarPolicy(int h)
voidsetLayout(LayoutManager l)
voidsetRowHeader(JViewport v)
voidsetRowHeaderView(Component c)
voidsetUI(ScrollPaneUI ui)
This method sets the scrollpane's UI delegate.
voidsetVerticalScrollBar(JScrollBar v)
voidsetVerticalScrollBarPolicy(int v)
voidsetViewport(JViewport v)
voidsetViewportBorder(Border b)
voidsetViewportView(Component view)
voidsetWheelScrollingEnabled(boolean b)
voidupdateUI()

Field Detail

columnHeader

protected JViewport columnHeader

horizontalScrollBar

protected JScrollBar horizontalScrollBar

horizontalScrollBarPolicy

protected int horizontalScrollBarPolicy

lowerLeft

protected Component lowerLeft

lowerRight

protected Component lowerRight

rowHeader

protected JViewport rowHeader

upperLeft

protected Component upperLeft

upperRight

protected Component upperRight

verticalScrollBar

protected JScrollBar verticalScrollBar

verticalScrollBarPolicy

protected int verticalScrollBarPolicy

viewport

protected JViewport viewport

Constructor Detail

JScrollPane

public JScrollPane()
Creates a new JScrollPane without a view. The scrollbar policy is set to {@link #VERTICAL_SCROLLBAR_AS_NEEDED} and {@link #HORIZONTAL_SCROLLBAR_AS_NEEDED}.

JScrollPane

public JScrollPane(Component view)
Creates a new JScrollPane that embeds the specified view component, displaying vertical and horizontal scrollbars as needed.

Parameters: view the component that is embedded inside the JScrollPane

JScrollPane

public JScrollPane(int vsbPolicy, int hsbPolicy)
Creates a new JScrollPane without a view; The scrollbar policies are set to vsbPolicy and hsbPolicy.

Parameters: vsbPolicy the vertical scrollbar policy to set hsbPolicy the vertical scrollbar policy to set

See Also: HORIZONTAL_SCROLLBAR_ALWAYS HORIZONTAL_SCROLLBAR_AS_NEEDED HORIZONTAL_SCROLLBAR_NEVER VERTICAL_SCROLLBAR_ALWAYS VERTICAL_SCROLLBAR_AS_NEEDED VERTICAL_SCROLLBAR_NEVER

JScrollPane

public JScrollPane(Component view, int vsbPolicy, int hsbPolicy)
Creates a new JScrollPane that embeds the specified view component; The scrollbar policies are set to vsbPolicy and hsbPolicy.

Parameters: vsbPolicy the vertical scrollbar policy to set hsbPolicy the vertical scrollbar policy to set

See Also: HORIZONTAL_SCROLLBAR_ALWAYS HORIZONTAL_SCROLLBAR_AS_NEEDED HORIZONTAL_SCROLLBAR_NEVER VERTICAL_SCROLLBAR_ALWAYS VERTICAL_SCROLLBAR_AS_NEEDED VERTICAL_SCROLLBAR_NEVER

Method Detail

createHorizontalScrollBar

public JScrollBar createHorizontalScrollBar()

createVerticalScrollBar

public JScrollBar createVerticalScrollBar()

createViewport

protected JViewport createViewport()

getAccessibleContext

public AccessibleContext getAccessibleContext()
Returns the accessible context associated with this JScrollPane.

Returns: the accessible context associated with this JScrollPane

getColumnHeader

public JViewport getColumnHeader()

getCorner

public Component getCorner(String key)

getHorizontalScrollBar

public JScrollBar getHorizontalScrollBar()

getHorizontalScrollBarPolicy

public int getHorizontalScrollBarPolicy()

getRowHeader

public JViewport getRowHeader()

getUI

public ScrollPaneUI getUI()
This method returns the scrollpane's UI delegate.

Returns: The scrollpane's UI delegate.

getUIClassID

public String getUIClassID()

getVerticalScrollBar

public JScrollBar getVerticalScrollBar()

getVerticalScrollBarPolicy

public int getVerticalScrollBarPolicy()

getViewport

public JViewport getViewport()

getViewportBorder

public Border getViewportBorder()

getViewportBorderBounds

public Rectangle getViewportBorderBounds()

isValidateRoot

public boolean isValidateRoot()

isWheelScrollingEnabled

public boolean isWheelScrollingEnabled()

setColumnHeader

public void setColumnHeader(JViewport h)

setColumnHeaderView

public void setColumnHeaderView(Component c)

setComponentOrientation

public void setComponentOrientation(ComponentOrientation co)

setCorner

public void setCorner(String key, Component c)

setHorizontalScrollBar

public void setHorizontalScrollBar(JScrollBar h)

setHorizontalScrollBarPolicy

public void setHorizontalScrollBarPolicy(int h)

setLayout

public void setLayout(LayoutManager l)

setRowHeader

public void setRowHeader(JViewport v)

setRowHeaderView

public void setRowHeaderView(Component c)

setUI

public void setUI(ScrollPaneUI ui)
This method sets the scrollpane's UI delegate.

Parameters: ui The scrollpane's UI delegate.

setVerticalScrollBar

public void setVerticalScrollBar(JScrollBar v)

setVerticalScrollBarPolicy

public void setVerticalScrollBarPolicy(int v)

setViewport

public void setViewport(JViewport v)

setViewportBorder

public void setViewportBorder(Border b)

setViewportView

public void setViewportView(Component view)

setWheelScrollingEnabled

public void setWheelScrollingEnabled(boolean b)

updateUI

public void updateUI()