|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--java.awt.Component | +--java.awt.Container | +--javax.swing.JComponent | +--javax.swing.JScrollPane
Safe:
Field Summary | |
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. |
private static String |
uiClassID
|
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. |
private javax.swing.border.Border |
viewportBorder
|
private boolean |
wheelScrollState
|
Fields inherited from class javax.swing.JComponent |
_bounds, accessibleContext, listenerList, paintingChild, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW |
Fields inherited from class java.awt.Container |
|
Fields inherited from class java.awt.Component |
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT |
Constructor Summary | |
JScrollPane()
Enabled: Creates an empty (no viewport view) JScrollPane
where both horizontal and vertical scrollbars appear when needed. |
|
JScrollPane(Component view)
Enabled: 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 view,
int vsbPolicy,
int hsbPolicy)
Enabled: 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)
Enabled: Creates an empty (no viewport view) JScrollPane
with specified
scrollbar policies. |
Method Summary | |
JScrollBar |
createHorizontalScrollBar()
Suppressed: Returns a JScrollPane.ScrollBar by default. |
JScrollBar |
createVerticalScrollBar()
Suppressed: Returns a JScrollPane.ScrollBar by default. |
protected JViewport |
createViewport()
Returns a new JViewport by default. |
AccessibleContext |
getAccessibleContext()
Suppressed: Gets the AccessibleContext associated with this JScrollPane. |
JViewport |
getColumnHeader()
Enabled: Returns the column header. |
Component |
getCorner(String key)
Enabled: Returns the component at the specified corner. |
JScrollBar |
getHorizontalScrollBar()
Enabled: Returns the horizontal scroll bar that controls the viewport's horizontal view position. |
int |
getHorizontalScrollBarPolicy()
Enabled: Returns the horizontal scroll bar policy value. |
JViewport |
getRowHeader()
Enabled: Returns the row header. |
javax.swing.plaf.ScrollPaneUI |
getUI()
Suppressed: Returns the look and feel (L&F) object that renders this component. |
String |
getUIClassID()
Suppressed: Returns the suffix used to construct the name of the L&F class used to render this component. |
JScrollBar |
getVerticalScrollBar()
Enabled: Returns the vertical scroll bar that controls the viewports vertical view position. |
int |
getVerticalScrollBarPolicy()
Enabled: Returns the vertical scroll bar policy value. |
JViewport |
getViewport()
Enabled: Returns the current JViewport . |
javax.swing.border.Border |
getViewportBorder()
Enabled: Returns the Border object that surrounds the viewport. |
Rectangle |
getViewportBorderBounds()
Enabled: Returns the bounds of the viewport's border. |
boolean |
isValidateRoot()
Enabled: Calls revalidate on any descendant of this
JScrollPane . |
boolean |
isWheelScrollingEnabled()
Enabled: 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 columnHeader)
Enabled: Removes the old columnHeader, if it exists. |
void |
setColumnHeaderView(Component view)
Enabled: Creates a column-header viewport if necessary, sets its view, and then adds the column-header viewport to the scrollpane. |
void |
setComponentOrientation(ComponentOrientation co)
Enabled: Sets the orientation for the vertical and horizontal scrollbars as determined by the ComponentOrientation argument. |
void |
setCorner(String key,
Component corner)
Enabled: Adds a child that will appear in one of the scroll panes corners, if there's room. |
void |
setHorizontalScrollBar(JScrollBar horizontalScrollBar)
Suppressed: Adds the scrollbar that controls the viewport's horizontal view position to the scrollpane. |
void |
setHorizontalScrollBarPolicy(int policy)
Enabled: Determines when the horizontal scrollbar appears in the scrollpane. |
void |
setLayout(LayoutManager layout)
Enabled: Sets the layout manager for this JScrollPane . |
void |
setRowHeader(JViewport rowHeader)
Enabled: Removes the old rowHeader, if it exists. |
void |
setRowHeaderView(Component view)
Enabled: Creates a row-header viewport if necessary, sets its view and then adds the row-header viewport to the scrollpane. |
void |
setUI(javax.swing.plaf.ScrollPaneUI ui)
Suppressed: Sets the ScrollPaneUI object that provides the
look and feel (L&F) for this component. |
void |
setVerticalScrollBar(JScrollBar verticalScrollBar)
Suppressed: Adds the scrollbar that controls the viewports vertical view position to the scrollpane. |
void |
setVerticalScrollBarPolicy(int policy)
Enabled: Determines when the vertical scrollbar appears in the scrollpane. |
void |
setViewport(JViewport viewport)
Enabled: 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(javax.swing.border.Border viewportBorder)
Enabled: Adds a border around the viewport. |
void |
setViewportView(Component view)
Enabled: Creates a viewport if necessary and then sets its view. |
void |
setWheelScrollingEnabled(boolean handleWheel)
Enabled: Enables/disables scrolling in response to movement of the mouse wheel. |
void |
updateUI()
Suppressed: Replaces the current ScrollPaneUI object with a version
from the current default look and feel. |
private void |
writeObject(ObjectOutputStream s)
See readObject and writeObject in
JComponent for more
information about serialization in Swing. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
private javax.swing.border.Border viewportBorder
private static final String uiClassID
getUIClassID()
,
JComponent.readObject(java.io.ObjectInputStream)
protected int verticalScrollBarPolicy
JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED
.
setVerticalScrollBarPolicy(int)
protected int horizontalScrollBarPolicy
JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED
.
setHorizontalScrollBarPolicy(int)
protected JViewport viewport
JViewport
.
setViewport(javax.swing.JViewport)
protected JScrollBar verticalScrollBar
JScrollBar
.
setVerticalScrollBar(javax.swing.JScrollBar)
protected JScrollBar horizontalScrollBar
JScrollBar
.
setHorizontalScrollBar(javax.swing.JScrollBar)
protected JViewport rowHeader
null
.
setRowHeader(javax.swing.JViewport)
protected JViewport columnHeader
null
.
setColumnHeader(javax.swing.JViewport)
protected Component lowerLeft
null
.
setCorner(java.lang.String, java.awt.Component)
protected Component lowerRight
null
.
setCorner(java.lang.String, java.awt.Component)
protected Component upperLeft
null
.
setCorner(java.lang.String, java.awt.Component)
protected Component upperRight
null
.
setCorner(java.lang.String, java.awt.Component)
private boolean wheelScrollState
Constructor Detail |
public JScrollPane(Component view, 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 viewportvsbPolicy
- an integer that specifies the vertical
scrollbar policyhsbPolicy
- an integer that specifies the horizontal
scrollbar policysetViewportView(java.awt.Component)
public JScrollPane(Component view)
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 viewportsetViewportView(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 policyhsbPolicy
- an integer that specifies the horizontal
scrollbar policysetViewportView(java.awt.Component)
public JScrollPane()
JScrollPane
where both horizontal and vertical scrollbars appear when needed.
Method Detail |
public javax.swing.plaf.ScrollPaneUI getUI()
ScrollPaneUI
object that renders this
componentsetUI(javax.swing.plaf.ScrollPaneUI)
public void setUI(javax.swing.plaf.ScrollPaneUI ui)
ScrollPaneUI
object that provides the
look and feel (L&F) for this component.
ui
- the ScrollPaneUI
L&F objectgetUI()
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 String getUIClassID()
getUIClassID
in class JComponent
JComponent.getUIClassID()
,
UIDefaults.getUI(javax.swing.JComponent)
public void setLayout(LayoutManager layout)
JScrollPane
.
This method overrides setLayout
in
java.awt.Container
to ensure that only
LayoutManager
s 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 managerjava.awt.Container#getLayout
,
java.awt.Container#setLayout
public boolean isValidateRoot()
revalidate
on any descendant of this
JScrollPane
. For example,
the viewport's view, will cause a request to be queued that
will validate the JScrollPane
and all its descendants.
isValidateRoot
in class JComponent
JComponent.revalidate()
public int getVerticalScrollBarPolicy()
verticalScrollBarPolicy
propertysetVerticalScrollBarPolicy(int)
public void setVerticalScrollBarPolicy(int policy)
policy
- one of the three values listed abovegetVerticalScrollBarPolicy()
public int getHorizontalScrollBarPolicy()
horizontalScrollBarPolicy
propertysetHorizontalScrollBarPolicy(int)
public void setHorizontalScrollBarPolicy(int policy)
policy
- one of the three values listed abovegetHorizontalScrollBarPolicy()
public javax.swing.border.Border getViewportBorder()
Border
object that surrounds the viewport.
viewportBorder
propertysetViewportBorder(javax.swing.border.Border)
public void setViewportBorder(javax.swing.border.Border viewportBorder)
JViewport
doesn't support
the JComponent
border property.
Similarly setting the JScrollPane
s
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 addedgetViewportBorder()
,
setViewport(javax.swing.JViewport)
public Rectangle getViewportBorderBounds()
Rectangle
object specifying the viewport borderpublic JScrollBar createHorizontalScrollBar()
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 orientationJScrollBar
public JScrollBar getHorizontalScrollBar()
horizontalScrollBar
propertysetHorizontalScrollBar(javax.swing.JScrollBar)
public void setHorizontalScrollBar(JScrollBar horizontalScrollBar)
JScrollPane
creates
horizontal and vertical scrollbars by default.
horizontalScrollBar
- the horizontal scrollbar to be addedcreateHorizontalScrollBar()
,
getHorizontalScrollBar()
public JScrollBar createVerticalScrollBar()
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 orientationJScrollBar
public JScrollBar getVerticalScrollBar()
verticalScrollBar
propertysetVerticalScrollBar(javax.swing.JScrollBar)
public void setVerticalScrollBar(JScrollBar verticalScrollBar)
JScrollPane
creates vertical and
horizontal scrollbars by default.
verticalScrollBar
- the new vertical scrollbar to be addedcreateVerticalScrollBar()
,
getVerticalScrollBar()
protected JViewport createViewport()
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 JViewport getViewport()
JViewport
.
viewport
propertysetViewport(javax.swing.JViewport)
public void setViewport(JViewport viewport)
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(Component view)
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 viewportsetViewport(javax.swing.JViewport)
,
JViewport.setView(java.awt.Component)
public JViewport getRowHeader()
rowHeader
propertysetRowHeader(javax.swing.JViewport)
public void setRowHeader(JViewport rowHeader)
null
, syncs the y coordinate of its
viewPosition with
the viewport (if there is one) and then adds it to the scrollpane.
Most applications will find it more convenient to use
setRowHeaderView
to add a row header component and its viewport to the scrollpane.
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(Component view)
JScrollPane scrollpane = new JScrollPane(); scrollpane.setViewportView(myBigComponentToScroll); scrollpane.setRowHeaderView(myBigComponentsRowHeader);
view
- the component to display as the row headersetRowHeader(javax.swing.JViewport)
,
JViewport.setView(java.awt.Component)
public JViewport getColumnHeader()
columnHeader
propertysetColumnHeader(javax.swing.JViewport)
public void setColumnHeader(JViewport columnHeader)
null
, sync the x coordinate of the its viewPosition
with the viewport (if there is one) and then add it to the scrollpane.
Most applications will find it more convenient to use
setRowHeaderView
to add a row header component and its viewport to the scrollpane.
getColumnHeader()
,
setColumnHeaderView(java.awt.Component)
public void setColumnHeaderView(Component view)
JScrollPane scrollpane = new JScrollPane(); scrollpane.setViewportView(myBigComponentToScroll); scrollpane.setColumnHeaderView(myBigComponentsColumnHeader);
view
- the component to display as the column headersetColumnHeader(javax.swing.JViewport)
,
JViewport.setView(java.awt.Component)
public Component getCorner(String key)
key
value specifying the corner is one of:
key
- one of the values as shown above
null
if key
is invalid:
setCorner(java.lang.String, java.awt.Component)
public void setCorner(String key, 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 incorner
- one of the following components:
public void setComponentOrientation(ComponentOrientation co)
ComponentOrientation
argument.
setComponentOrientation
in class Component
co
- one of the following values:
java.awt.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()
,
java.awt.event.MouseWheelEvent
,
java.awt.event.MouseWheelListener
private void writeObject(ObjectOutputStream s) throws IOException
readObject
and writeObject
in
JComponent
for more
information about serialization in Swing.
s
- the ObjectOutputStream
in which to write
IOException
protected String paramString()
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 AccessibleContext getAccessibleContext()
getAccessibleContext
in interface Accessible
getAccessibleContext
in class JComponent
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |