java.awt.event
public class: PaintEvent [javadoc |
source]
java.lang.Object
java.util.EventObject
java.awt.AWTEvent
java.awt.event.ComponentEvent
java.awt.event.PaintEvent
All Implemented Interfaces:
Serializable
The component-level paint event.
This event is a special type which is used to ensure that
paint/update method calls are serialized along with the other
events delivered from the event queue. This event is not
designed to be used with the Event Listener model; programs
should continue to override paint/update methods in order
render themselves properly.
An unspecified behavior will be caused if the {@code id} parameter
of any particular {@code PaintEvent} instance is not
in the range from {@code PAINT_FIRST} to {@code PAINT_LAST}.
- author:
Amy - Fowler
- since:
1.1 -
| Field Summary |
|---|
| public static final int | PAINT_FIRST | Marks the first integer id for the range of paint event ids. |
| public static final int | PAINT_LAST | Marks the last integer id for the range of paint event ids. |
| public static final int | PAINT | The paint event type. |
| public static final int | UPDATE | The update event type. |
| Rectangle | updateRect | This is the rectangle that represents the area on the source
component that requires a repaint.
This rectangle should be non null. |
| 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 PaintEvent(Component source,
int id,
Rectangle updateRect) {
super(source, id);
this.updateRect = updateRect;
}
Parameters:
source - The object where the event originated
id - The integer that identifies the event type.
For information on allowable values, see
the class description for PaintEvent
updateRect - The rectangle area which needs to be repainted
Throws:
IllegalArgumentException - if source is null
Also see:
- getSource()
- getID()
- getUpdateRect()
|
| Methods from java.lang.Object: |
|---|
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method from java.awt.event.PaintEvent Detail: |
public Rectangle getUpdateRect() {
return updateRect;
}
Returns the rectangle representing the area which needs to be
repainted in response to this event. |
public String paramString() {
String typeStr;
switch(id) {
case PAINT:
typeStr = "PAINT";
break;
case UPDATE:
typeStr = "UPDATE";
break;
default:
typeStr = "unknown type";
}
return typeStr + ",updateRect="+(updateRect != null ? updateRect.toString() : "null");
}
|
public void setUpdateRect(Rectangle updateRect) {
this.updateRect = updateRect;
}
Sets the rectangle representing the area which needs to be
repainted in response to this event. |