java.awt.event
public class: AdjustmentEvent [javadoc |
source]
java.lang.Object
java.util.EventObject
java.awt.AWTEvent
java.awt.event.AdjustmentEvent
All Implemented Interfaces:
Serializable
The adjustment event emitted by Adjustable objects like
java.awt.Scrollbar and
java.awt.ScrollPane .
When the user changes the value of the scrolling component,
it receives an instance of {@code AdjustmentEvent}.
An unspecified behavior will be caused if the {@code id} parameter
of any particular {@code AdjustmentEvent} instance is not
in the range from {@code ADJUSTMENT_FIRST} to {@code ADJUSTMENT_LAST}.
The {@code type} of any {@code AdjustmentEvent} instance takes one of the following
values:
- {@code UNIT_INCREMENT}
- {@code UNIT_DECREMENT}
- {@code BLOCK_INCREMENT}
- {@code BLOCK_DECREMENT}
- {@code TRACK}
Assigning the value different from listed above will cause an unspecified behavior.
| Field Summary |
|---|
| public static final int | ADJUSTMENT_FIRST | Marks the first integer id for the range of adjustment event ids. |
| public static final int | ADJUSTMENT_LAST | Marks the last integer id for the range of adjustment event ids. |
| public static final int | ADJUSTMENT_VALUE_CHANGED | The adjustment value changed event. |
| public static final int | UNIT_INCREMENT | The unit increment adjustment type. |
| public static final int | UNIT_DECREMENT | The unit decrement adjustment type. |
| public static final int | BLOCK_DECREMENT | The block decrement adjustment type. |
| public static final int | BLOCK_INCREMENT | The block increment adjustment type. |
| public static final int | TRACK | The absolute tracking adjustment type. |
| Adjustable | adjustable | The adjustable object that fired the event. |
| int | value | value will contain the new value of the
adjustable object. This value will always be in a
range associated adjustable object. |
| int | adjustmentType | The adjustmentType describes how the adjustable
object value has changed.
This value can be increased/decreased by a block or unit amount
where the block is associated with page increments/decrements,
and a unit is associated with line increments/decrements. |
| boolean | isAdjusting | The isAdjusting is true if the event is one
of the series of multiple adjustment events. |
| Fields inherited from java.awt.AWTEvent: |
|---|
| id, consumed, focusManagerIsDispatching, isPosted, COMPONENT_EVENT_MASK, CONTAINER_EVENT_MASK, FOCUS_EVENT_MASK, KEY_EVENT_MASK, MOUSE_EVENT_MASK, MOUSE_MOTION_EVENT_MASK, WINDOW_EVENT_MASK, ACTION_EVENT_MASK, ADJUSTMENT_EVENT_MASK, ITEM_EVENT_MASK, TEXT_EVENT_MASK, INPUT_METHOD_EVENT_MASK, INPUT_METHODS_ENABLED_MASK, PAINT_EVENT_MASK, INVOCATION_EVENT_MASK, HIERARCHY_EVENT_MASK, HIERARCHY_BOUNDS_EVENT_MASK, MOUSE_WHEEL_EVENT_MASK, WINDOW_STATE_EVENT_MASK, WINDOW_FOCUS_EVENT_MASK, RESERVED_ID_MAX |
| Constructor: |
public AdjustmentEvent(Adjustable source,
int id,
int type,
int value) {
this(source, id, type, value, false);
}
Parameters:
source - The Adjustable object where the
event originated
id - An integer indicating the type of event.
For information on allowable values, see
the class description for AdjustmentEvent
type - An integer indicating the adjustment type.
For information on allowable values, see
the class description for AdjustmentEvent
value - The current value of the adjustment
Throws:
IllegalArgumentException - if source is null
Also see:
- getSource()
- getID()
- getAdjustmentType()
- getValue()
|
public AdjustmentEvent(Adjustable source,
int id,
int type,
int value,
boolean isAdjusting) {
super(source, id);
adjustable = source;
this.adjustmentType = type;
this.value = value;
this.isAdjusting = isAdjusting;
}
Parameters:
source - The Adjustable object where the
event originated
id - An integer indicating the type of event.
For information on allowable values, see
the class description for AdjustmentEvent
type - An integer indicating the adjustment type.
For information on allowable values, see
the class description for AdjustmentEvent
value - The current value of the adjustment
isAdjusting - A boolean that equals true if the event is one
of a series of multiple adjusting events,
otherwise false
Throws:
IllegalArgumentException - if source is null
Also see:
- getSource()
- getID()
- getAdjustmentType()
- getValue()
- getValueIsAdjusting()
- since:
1.4 -
|
| Methods from java.lang.Object: |
|---|
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method from java.awt.event.AdjustmentEvent Detail: |
public Adjustable getAdjustable() {
return adjustable;
}
Returns the Adjustable object where this event originated. |
public int getAdjustmentType() {
return adjustmentType;
}
Returns the type of adjustment which caused the value changed
event. It will have one of the following values:
|
public int getValue() {
return value;
}
Returns the current value in the adjustment event. |
public boolean getValueIsAdjusting() {
return isAdjusting;
}
Returns true if this is one of multiple
adjustment events. |
public String paramString() {
String typeStr;
switch(id) {
case ADJUSTMENT_VALUE_CHANGED:
typeStr = "ADJUSTMENT_VALUE_CHANGED";
break;
default:
typeStr = "unknown type";
}
String adjTypeStr;
switch(adjustmentType) {
case UNIT_INCREMENT:
adjTypeStr = "UNIT_INCREMENT";
break;
case UNIT_DECREMENT:
adjTypeStr = "UNIT_DECREMENT";
break;
case BLOCK_INCREMENT:
adjTypeStr = "BLOCK_INCREMENT";
break;
case BLOCK_DECREMENT:
adjTypeStr = "BLOCK_DECREMENT";
break;
case TRACK:
adjTypeStr = "TRACK";
break;
default:
adjTypeStr = "unknown type";
}
return typeStr
+ ",adjType="+adjTypeStr
+ ",value="+value
+ ",isAdjusting="+isAdjusting;
}
|