|
Préférences
Moteurs de recherche
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
JavaTM 2 Platform Std. Ed. v1.4.2
java.awt
|
Nested Class Summary | |
protected class |
Scrollbar.AccessibleAWTScrollBar
This class implements accessibility support for the Scrollbar class. |
Nested classes inherited from class java.awt.Component |
Component.AccessibleAWTComponent, Component.BltBufferStrategy, Component.FlipBufferStrategy |
Field Summary | |
static int |
HORIZONTAL
A constant that indicates a horizontal scroll bar. |
static int |
VERTICAL
A constant that indicates a vertical scroll bar. |
Fields inherited from class java.awt.Component |
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT |
Fields inherited from interface java.awt.Adjustable |
NO_ORIENTATION |
Fields inherited from interface java.awt.image.ImageObserver |
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
Constructor Summary | |
Scrollbar()
Constructs a new vertical scroll bar. |
|
Scrollbar(int orientation)
Constructs a new scroll bar with the specified orientation. |
|
Scrollbar(int orientation,
int value,
int visible,
int minimum,
int maximum)
Constructs a new scroll bar with the specified orientation, initial value, visible amount, and minimum and maximum values. |
Method Summary | |
void |
addAdjustmentListener(AdjustmentListener l)
Adds the specified adjustment listener to receive instances of AdjustmentEvent from this scroll bar. |
void |
addNotify()
Creates the Scrollbar 's peer. |
AccessibleContext |
getAccessibleContext()
Gets the AccessibleContext associated with this
Scrollbar . |
AdjustmentListener[] |
getAdjustmentListeners()
Returns an array of all the adjustment listeners registered on this scrollbar. |
int |
getBlockIncrement()
Gets the block increment of this scroll bar. |
int |
getLineIncrement()
Deprecated. As of JDK version 1.1, replaced by getUnitIncrement() . |
EventListener[] |
getListeners(Class listenerType)
Returns an array of all the objects currently registered as FooListener s
upon this Scrollbar . |
int |
getMaximum()
Gets the maximum value of this scroll bar. |
int |
getMinimum()
Gets the minimum value of this scroll bar. |
int |
getOrientation()
Returns the orientation of this scroll bar. |
int |
getPageIncrement()
Deprecated. As of JDK version 1.1, replaced by getBlockIncrement() . |
int |
getUnitIncrement()
Gets the unit increment for this scrollbar. |
int |
getValue()
Gets the current value of this scroll bar. |
boolean |
getValueIsAdjusting()
Returns true if the value is in the process of changing as a result of actions being taken by the user. |
int |
getVisible()
Deprecated. As of JDK version 1.1, replaced by getVisibleAmount() . |
int |
getVisibleAmount()
Gets the visible amount of this scroll bar. |
protected String |
paramString()
Returns a string representing the state of this Scrollbar . |
protected void |
processAdjustmentEvent(AdjustmentEvent e)
Processes adjustment events occurring on this scrollbar by dispatching them to any registered AdjustmentListener objects. |
protected void |
processEvent(AWTEvent e)
Processes events on this scroll bar. |
void |
removeAdjustmentListener(AdjustmentListener l)
Removes the specified adjustment listener so that it no longer receives instances of AdjustmentEvent from this scroll bar. |
void |
setBlockIncrement(int v)
Sets the block increment for this scroll bar. |
void |
setLineIncrement(int v)
Deprecated. As of JDK version 1.1, replaced by setUnitIncrement(int) . |
void |
setMaximum(int newMaximum)
Sets the maximum value of this scroll bar. |
void |
setMinimum(int newMinimum)
Sets the minimum value of this scroll bar. |
void |
setOrientation(int orientation)
Sets the orientation for this scroll bar. |
void |
setPageIncrement(int v)
Deprecated. As of JDK version 1.1, replaced by setBlockIncrement() . |
void |
setUnitIncrement(int v)
Sets the unit increment for this scroll bar. |
void |
setValue(int newValue)
Sets the value of this scroll bar to the specified value. |
void |
setValueIsAdjusting(boolean b)
Sets the valueIsAdjusting property. |
void |
setValues(int value,
int visible,
int minimum,
int maximum)
Sets the values of four properties for this scroll bar: value , visibleAmount ,
minimum , and maximum . |
void |
setVisibleAmount(int newAmount)
Sets the visible amount of this scroll bar. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
public static final int HORIZONTAL
public static final int VERTICAL
Constructor Detail |
public Scrollbar() throws HeadlessException
Property | Description | Default Value |
---|---|---|
orientation | indicates if the scroll bar is vertical or horizontal | Scrollbar.VERTICAL |
value | value which controls the location
of the scroll bar bubble |
0 |
minimum | minimum value of the scroll bar | 0 |
maximum | maximum value of the scroll bar | 100 |
unit increment | amount the value changes when the
Line Up or Line Down key is pressed, or when the end arrows of the scrollbar are clicked |
1 |
block increment | amount the value changes when the
Page Up or Page Down key is pressed, or when the scrollbar track is clicked on either side of the bubble |
10 |
HeadlessException
- if GraphicsEnvironment.isHeadless()
returns true.GraphicsEnvironment.isHeadless()
public Scrollbar(int orientation) throws HeadlessException
The orientation
argument must take one of the two
values Scrollbar.HORIZONTAL
,
or Scrollbar.VERTICAL
,
indicating a horizontal or vertical scroll bar, respectively.
orientation
- indicates the orientation of the scroll bar
IllegalArgumentException
- when an illegal value for
the orientation
argument is supplied
HeadlessException
- if GraphicsEnvironment.isHeadless()
returns true.GraphicsEnvironment.isHeadless()
public Scrollbar(int orientation, int value, int visible, int minimum, int maximum) throws HeadlessException
The orientation
argument must take one of the two
values Scrollbar.HORIZONTAL
,
or Scrollbar.VERTICAL
,
indicating a horizontal or vertical scroll bar, respectively.
The parameters supplied to this constructor are subject to the
constraints described in setValues(int, int, int, int)
.
orientation
- indicates the orientation of the scroll bar.value
- the initial value of the scroll barvisible
- the size of the scroll bar's bubble, representing
the visible portion.minimum
- the minimum value of the scroll barmaximum
- the maximum value of the scroll bar
IllegalArgumentException
- when an illegal value for
the orientation
argument is supplied
HeadlessException
- if GraphicsEnvironment.isHeadless()
returns true.setValues(int, int, int, int)
,
GraphicsEnvironment.isHeadless()
Method Detail |
public void addNotify()
Scrollbar
's peer. The peer allows you to modify
the appearance of the Scrollbar
without changing any of its
functionality.
public int getOrientation()
getOrientation
in interface Adjustable
Scrollbar.HORIZONTAL
or
Scrollbar.VERTICAL
setOrientation(int)
public void setOrientation(int orientation)
orientation
- the orientation of this scroll bar, either
Scrollbar.HORIZONTAL
or
Scrollbar.VERTICAL
IllegalArgumentException
- if the value supplied
for orientation
is not a
legal valuegetOrientation()
public int getValue()
getValue
in interface Adjustable
getMinimum()
,
getMaximum()
public void setValue(int newValue)
If the value supplied is less than the current minimum
or greater than the current
maximum
- visibleAmount
, then one of
those values is substituted, as appropriate.
Normally, a program should change a scroll bar's
value only by calling setValues
.
The setValues
method simultaneously
and synchronously sets the minimum, maximum, visible amount,
and value properties of a scroll bar, so that they are
mutually consistent.
setValue
in interface Adjustable
newValue
- the new value of the scroll barsetValues(int, int, int, int)
,
getValue()
,
getMinimum()
,
getMaximum()
public int getMinimum()
getMinimum
in interface Adjustable
getValue()
,
getMaximum()
public void setMinimum(int newMinimum)
When setMinimum
is called, the limiting argument takes
precedence over the existing scrollbar value.
Normally, a program should change a scroll bar's minimum
value only by calling setValues
.
The setValues
method simultaneously
and synchronously sets the minimum, maximum, visible amount,
and value properties of a scroll bar, so that they are
mutually consistent.
Note that setting the minimum value to Integer.MIN_VALUE
will result in the new minimum value to be set to
Integer.MIN_VALUE - 1
.
setMinimum
in interface Adjustable
newMinimum
- the new minimum value for this scroll barsetValues(int, int, int, int)
,
setMaximum(int)
public int getMaximum()
getMaximum
in interface Adjustable
getValue()
,
getMinimum()
public void setMaximum(int newMaximum)
When setMaximum
is called, the limiting
argument takes precedence over the existing scrollbar
value.
Normally, a program should change a scroll bar's maximum
value only by calling setValues
.
The setValues
method simultaneously
and synchronously sets the minimum, maximum, visible amount,
and value properties of a scroll bar, so that they are
mutually consistent.
setMaximum
in interface Adjustable
newMaximum
- the new maximum value
for this scroll barsetValues(int, int, int, int)
,
setMinimum(int)
public int getVisibleAmount()
The visible amount of a scroll bar is the range of values represented by the width of the scroll bar's bubble.
getVisibleAmount
in interface Adjustable
setVisibleAmount(int)
public int getVisible()
getVisibleAmount()
.
public void setVisibleAmount(int newAmount)
The visible amount of a scroll bar is the range of values represented by the width of the scroll bar's bubble.
Normally, a program should change a scroll bar's
value only by calling setValues
.
The setValues
method simultaneously
and synchronously sets the minimum, maximum, visible amount,
and value properties of a scroll bar, so that they are
mutually consistent.
setVisibleAmount
in interface Adjustable
newAmount
- the amount visible per pagegetVisibleAmount()
,
setValues(int, int, int, int)
public void setUnitIncrement(int v)
The unit increment is the value that is added (subtracted) when the user activates the unit increment area of the scroll bar, generally through a mouse or keyboard gesture that the scroll bar receives as an adjustment event.
setUnitIncrement
in interface Adjustable
v
- the amount by which to increment or decrement
the scroll bar's valuegetUnitIncrement()
public void setLineIncrement(int v)
setUnitIncrement(int)
.
public int getUnitIncrement()
The unit increment is the value that is added (subtracted) when the user activates the unit increment area of the scroll bar, generally through a mouse or keyboard gesture that the scroll bar receives as an adjustment event.
getUnitIncrement
in interface Adjustable
setUnitIncrement(int)
public int getLineIncrement()
getUnitIncrement()
.
public void setBlockIncrement(int v)
The block increment is the value that is added (subtracted) when the user activates the block increment area of the scroll bar, generally through a mouse or keyboard gesture that the scroll bar receives as an adjustment event.
setBlockIncrement
in interface Adjustable
v
- the amount by which to increment or decrement
the scroll bar's valuegetBlockIncrement()
public void setPageIncrement(int v)
setBlockIncrement()
.
public int getBlockIncrement()
The block increment is the value that is added (subtracted) when the user activates the block increment area of the scroll bar, generally through a mouse or keyboard gesture that the scroll bar receives as an adjustment event.
getBlockIncrement
in interface Adjustable
setBlockIncrement(int)
public int getPageIncrement()
getBlockIncrement()
.
public void setValues(int value, int visible, int minimum, int maximum)
value
, visibleAmount
,
minimum
, and maximum
.
If the values supplied for these properties are inconsistent
or incorrect, they will be changed to ensure consistency.
This method simultaneously and synchronously sets the values
of four scroll bar properties, assuring that the values of
these properties are mutually consistent. It enforces the
following constraints:
maximum
must be greater than minimum
,
visibleAmount
must be positive,
visibleAmount
must not be greater than
maximum
- minimum
,
value
must not be less than minimum
,
and value
must not be greater than
maximum
- visibleAmount
value
- is the position in the current windowvisible
- is the amount visible per pageminimum
- is the minimum value of the scroll barmaximum
- is the maximum value of the scroll barsetMinimum(int)
,
setMaximum(int)
,
setVisibleAmount(int)
,
setValue(int)
public boolean getValueIsAdjusting()
valueIsAdjusting
propertysetValueIsAdjusting(boolean)
public void setValueIsAdjusting(boolean b)
valueIsAdjusting
property.
b
- new adjustment-in-progress statusgetValueIsAdjusting()
public void addAdjustmentListener(AdjustmentListener l)
AdjustmentEvent
from this scroll bar.
If l is null
, no exception is thrown and no
action is performed.
addAdjustmentListener
in interface Adjustable
l
- the adjustment listenerremoveAdjustmentListener(java.awt.event.AdjustmentListener)
,
getAdjustmentListeners()
,
AdjustmentEvent
,
AdjustmentListener
public void removeAdjustmentListener(AdjustmentListener l)
AdjustmentEvent
from this scroll bar.
If l is null
, no exception is thrown and no action
is performed.
removeAdjustmentListener
in interface Adjustable
l
- the adjustment listeneraddAdjustmentListener(java.awt.event.AdjustmentListener)
,
getAdjustmentListeners()
,
AdjustmentEvent
,
AdjustmentListener
public AdjustmentListener[] getAdjustmentListeners()
AdjustmentListener
s
or an empty array if no adjustment
listeners are currently registeredaddAdjustmentListener(java.awt.event.AdjustmentListener)
,
removeAdjustmentListener(java.awt.event.AdjustmentListener)
,
AdjustmentEvent
,
AdjustmentListener
public EventListener[] getListeners(Class listenerType)
FooListener
s
upon this Scrollbar
.
FooListener
s are registered using the
addFooListener
method.
You can specify the listenerType
argument
with a class literal, such as
FooListener.class
.
For example, you can query a
Scrollbar
c
for its mouse listeners with the following code:
MouseListener[] mls = (MouseListener[])(c.getListeners(MouseListener.class));If no such listeners exist, this method returns an empty array.
getListeners
in class Component
listenerType
- the type of listeners requested; this parameter
should specify an interface that descends from
java.util.EventListener
FooListener
s on this component,
or an empty array if no such listeners have been added
ClassCastException
- if listenerType
doesn't specify a class or interface that implements
java.util.EventListener
Component.getComponentListeners()
,
Component.getFocusListeners()
,
Component.getHierarchyListeners()
,
Component.getHierarchyBoundsListeners()
,
Component.getKeyListeners()
,
Component.getMouseListeners()
,
Component.getMouseMotionListeners()
,
Component.getMouseWheelListeners()
,
Component.getInputMethodListeners()
,
Component.getPropertyChangeListeners()
protected void processEvent(AWTEvent e)
AdjustmentEvent
, it invokes the
processAdjustmentEvent
method.
Otherwise, it invokes its superclass's
processEvent
method.
Note that if the event parameter is null
the behavior is unspecified and may result in an
exception.
processEvent
in class Component
e
- the eventAdjustmentEvent
,
processAdjustmentEvent(java.awt.event.AdjustmentEvent)
protected void processAdjustmentEvent(AdjustmentEvent e)
AdjustmentListener
objects.
This method is not called unless adjustment events are enabled for this component. Adjustment events are enabled when one of the following occurs:
AdjustmentListener
object is registered
via addAdjustmentListener
.
enableEvents
.
Note that if the event parameter is null
the behavior is unspecified and may result in an
exception.
e
- the adjustment eventAdjustmentEvent
,
AdjustmentListener
,
addAdjustmentListener(java.awt.event.AdjustmentListener)
,
Component.enableEvents(long)
protected String paramString()
Scrollbar
.
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 Component
public AccessibleContext getAccessibleContext()
AccessibleContext
associated with this
Scrollbar
. For scrollbars, the
AccessibleContext
takes the form of an
AccessibleAWTScrollBar
. A new
AccessibleAWTScrollBar
instance is created if necessary.
getAccessibleContext
in interface Accessible
getAccessibleContext
in class Component
AccessibleAWTScrollBar
that serves as the
AccessibleContext
of this ScrollBar