|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.awt.Component
java.awt.Container
java.awt.ScrollPane
public class ScrollPane
This widget provides a scrollable region that allows a single subcomponent to be viewed through a smaller window.
Nested Class Summary | |
---|---|
protected class |
ScrollPane.AccessibleAWTScrollPane
|
Nested classes/interfaces inherited from class java.awt.Container |
---|
Container.AccessibleAWTContainer |
Nested classes/interfaces inherited from class java.awt.Component |
---|
Component.AccessibleAWTComponent, Component.BltBufferStrategy, Component.FlipBufferStrategy |
Field Summary | |
---|---|
static int |
SCROLLBARS_ALWAYS
Constant indicating that scrollbars are always displayed in this window. |
static int |
SCROLLBARS_AS_NEEDED
Constant indicating that scrollbars are created as needed in this windows. |
static int |
SCROLLBARS_NEVER
Constant indicating that scrollbars are never displayed in this window. |
Fields inherited from class java.awt.Component |
---|
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT |
Fields inherited from interface java.awt.image.ImageObserver |
---|
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
Constructor Summary | |
---|---|
ScrollPane()
Initializes a new instance of ScrollPane with a default
scrollbar policy of SCROLLBARS_AS_NEEDED . |
|
ScrollPane(int scrollbarDisplayPolicy)
Initializes a new instance of ScrollPane with the
specified scrollbar policy. |
Method Summary | |
---|---|
protected void |
addImpl(Component component,
Object constraints,
int index)
Adds the specified child component to this container. |
void |
addNotify()
Notifies this object that it should create its native peer. |
void |
doLayout()
Lays out this component. |
protected boolean |
eventTypeEnabled(int type)
Tells whether or not an event is enabled. |
AccessibleContext |
getAccessibleContext()
Gets the AccessibleContext associated with this ScrollPane . |
Adjustable |
getHAdjustable()
Returns the horizontal scrollbar for this object. |
int |
getHScrollbarHeight()
Returns the height of a horizontal scrollbar. |
int |
getScrollbarDisplayPolicy()
Returns the current scrollbar display policy. |
Point |
getScrollPosition()
Returns the current scroll position of the viewport. |
Adjustable |
getVAdjustable()
Returns the vertical scrollbar for this object. |
Dimension |
getViewportSize()
Returns the current viewport size. |
int |
getVScrollbarWidth()
Returns the width of a vertical scrollbar. |
boolean |
isWheelScrollingEnabled()
Tells whether or not wheel scrolling is enabled. |
void |
layout()
Deprecated. This method is deprecated in favor of doLayout() . |
String |
paramString()
Returns a debug string for this object. |
void |
printComponents(Graphics graphics)
Prints all of the components in this container. |
void |
removeNotify()
Notifies this object that it should destroy its native peers. |
void |
setLayout(LayoutManager layoutManager)
This method overrides its superclass method to ensure no layout manager is set for this container. |
void |
setScrollPosition(int x,
int y)
Sets the scroll position to the specified value. |
void |
setScrollPosition(Point scrollPosition)
Sets the scroll position to the specified value. |
void |
setWheelScrollingEnabled(boolean enable)
Enables/disables wheel scrolling. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final int SCROLLBARS_AS_NEEDED
public static final int SCROLLBARS_ALWAYS
public static final int SCROLLBARS_NEVER
Constructor Detail |
---|
public ScrollPane()
ScrollPane
with a default
scrollbar policy of SCROLLBARS_AS_NEEDED
.
HeadlessException
- If GraphicsEnvironment.isHeadless() is true.public ScrollPane(int scrollbarDisplayPolicy)
ScrollPane
with the
specified scrollbar policy.
scrollbarDisplayPolicy
- When to display scrollbars, which must
be one of the constants defined in this class.
HeadlessException
- If GraphicsEnvironment.isHeadless() is true.Method Detail |
---|
public int getScrollbarDisplayPolicy()
public Adjustable getHAdjustable()
SCROLLBARS_NEVER
then this
will be null
.
public Adjustable getVAdjustable()
SCROLLBARS_NEVER
then this
will be null
.
public Dimension getViewportSize()
public int getHScrollbarHeight()
public int getVScrollbarWidth()
public Point getScrollPosition()
NullPointerException
- if the scrollpane does have a child.public void setScrollPosition(Point scrollPosition) throws IllegalArgumentException
scrollPosition
- The new scrollPosition.
IllegalArgumentException
- If the specified value is outside
the legal scrolling range.public void setScrollPosition(int x, int y)
x
- The new X coordinate of the scroll position.y
- The new Y coordinate of the scroll position.
NullPointerException
- if scrollpane does not have a child.
IllegalArgumentException
- If the specified value is outside
the legal scrolling range.public void addNotify()
addNotify
in class Container
Component.isDisplayable()
,
Component.removeNotify()
public void removeNotify()
removeNotify
in class Container
Component.isDisplayable()
,
Component.addNotify()
protected final void addImpl(Component component, Object constraints, int index)
ScrollPane
can have at most one child, so if a second
one is added, then first one is removed.
addImpl
in class Container
component
- The component to add to this container.constraints
- A list of layout constraints for this object.index
- The index at which to add the child, which is ignored
in this implementation.public void doLayout()
doLayout
in class Container
Component.validate()
,
LayoutManager
public void layout()
doLayout()
.
layout
in class Container
public final void setLayout(LayoutManager layoutManager)
ScrollPane
's do
not have layout managers.
setLayout
in class Container
layoutManager
- Ignored
AWTError
- Always throws this error when called.public void printComponents(Graphics graphics)
printComponents
in class Container
graphics
- The desired graphics context for printing.public String paramString()
paramString
in class Container
protected boolean eventTypeEnabled(int type)
type
- The event id to check.
true
if a listener for the event id exists or
if the eventMask is set for the event id.Component.eventTypeEnabled(int)
public boolean isWheelScrollingEnabled()
public void setWheelScrollingEnabled(boolean enable)
public AccessibleContext getAccessibleContext()
ScrollPane
.
The context is created, if necessary.
getAccessibleContext
in interface Accessible
getAccessibleContext
in class Component
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |