APIdia Launch Partner
Top Description Fields Constructors Methods
java.awt.event

public Class PaintEvent

extends ComponentEvent
Class Inheritance
Known Direct Subclasses
sun.awt.event.IgnorePaintEvent
Imports
java.awt.Component, .Rectangle, java.io.Serial

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 id parameter of any particular PaintEvent instance is not in the range from PAINT_FIRST to PAINT_LAST.

Author
Amy Fowler
Since
1.1

Field Summary

Modifier and TypeField and Description
public static final int
PAINT

The paint event type.

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.

private static final long
serialVersionUID

Hides java.awt.event.ComponentEvent.serialVersionUID.

Use serialVersionUID from JDK 1.1 for interoperability.
public static final int
UPDATE

The update event type.

pack-priv Rectangle
updateRect

This is the rectangle that represents the area on the source component that requires a repaint.

Inherited from java.awt.event.ComponentEvent:
COMPONENT_FIRSTCOMPONENT_HIDDENCOMPONENT_LASTCOMPONENT_MOVEDCOMPONENT_RESIZEDCOMPONENT_SHOWN

Constructor Summary

AccessConstructor and Description
public
PaintEvent(Component
The object where the event originated
source
,
int
The integer that identifies the event type. For information on allowable values, see the class description for PaintEvent
id
,
Rectangle
The rectangle area which needs to be repainted
updateRect
)

Constructs a PaintEvent object with the specified source component and type.

Method Summary

Modifier and TypeMethod and Description
public Rectangle

Returns:

the rectangle representing the area which needs to be repainted in response to this event
getUpdateRect
()

Returns the rectangle representing the area which needs to be repainted in response to this event.

public String
paramString()

Overrides java.awt.event.ComponentEvent.paramString.

Returns a parameter string identifying this event.

public void
setUpdateRect(Rectangle
the rectangle area which needs to be repainted
updateRect
)

Sets the rectangle representing the area which needs to be repainted in response to this event.

Inherited from java.awt.event.ComponentEvent:
getComponent

Field Detail

PAINTback to summary
public static final int PAINT

The paint event type.

PAINT_FIRSTback to summary
public static final int PAINT_FIRST

Marks the first integer id for the range of paint event ids.

PAINT_LASTback to summary
public static final int PAINT_LAST

Marks the last integer id for the range of paint event ids.

serialVersionUIDback to summary
private static final long serialVersionUID

Hides java.awt.event.ComponentEvent.serialVersionUID.

Use serialVersionUID from JDK 1.1 for interoperability.

Annotations
@Serial
UPDATEback to summary
public static final int UPDATE

The update event type.

updateRectback to summary
pack-priv Rectangle updateRect

This is the rectangle that represents the area on the source component that requires a repaint. This rectangle should be non null.

See Also
java.awt.Rectangle, setUpdateRect(Rectangle), getUpdateRect()

Constructor Detail

PaintEventback to summary
public PaintEvent(Component source, int id, Rectangle updateRect)

Constructs a PaintEvent object with the specified source component and type.

This method throws an IllegalArgumentException if source is null.

Parameters
source:Component

The object where the event originated

id:int

The integer that identifies the event type. For information on allowable values, see the class description for PaintEvent

updateRect:Rectangle

The rectangle area which needs to be repainted

Exceptions
IllegalArgumentException:
if source is null
See Also
getSource(), getID(), getUpdateRect()

Method Detail

getUpdateRectback to summary
public Rectangle getUpdateRect()

Returns the rectangle representing the area which needs to be repainted in response to this event.

Returns:Rectangle

the rectangle representing the area which needs to be repainted in response to this event

paramStringback to summary
public String paramString()

Overrides java.awt.event.ComponentEvent.paramString.

Doc from java.awt.event.ComponentEvent.paramString.

Returns a parameter string identifying this event. This method is useful for event-logging and for debugging.

setUpdateRectback to summary
public void setUpdateRect(Rectangle updateRect)

Sets the rectangle representing the area which needs to be repainted in response to this event.

Parameters
updateRect:Rectangle

the rectangle area which needs to be repainted