java.awt.event

Class PaintEvent

Implemented Interfaces:
Serializable

public class PaintEvent
extends ComponentEvent

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.
Since:
1.1
See Also:
Serialized Form

Field Summary

static int
PAINT
The paint event type.
static int
PAINT_FIRST
Marks the first integer id for the range of paint event ids.
static int
PAINT_LAST
Marks the last integer id for the range of paint event ids.
static int
UPDATE
The update event type.

Fields inherited from class java.awt.event.ComponentEvent

COMPONENT_FIRST, COMPONENT_HIDDEN, COMPONENT_LAST, COMPONENT_MOVED, COMPONENT_RESIZED, COMPONENT_SHOWN

Fields inherited from class java.awt.AWTEvent

ACTION_EVENT_MASK, ADJUSTMENT_EVENT_MASK, COMPONENT_EVENT_MASK, CONTAINER_EVENT_MASK, FOCUS_EVENT_MASK, HIERARCHY_BOUNDS_EVENT_MASK, HIERARCHY_EVENT_MASK, INPUT_METHOD_EVENT_MASK, INVOCATION_EVENT_MASK, ITEM_EVENT_MASK, KEY_EVENT_MASK, MOUSE_EVENT_MASK, MOUSE_MOTION_EVENT_MASK, MOUSE_WHEEL_EVENT_MASK, PAINT_EVENT_MASK, RESERVED_ID_MAX, TEXT_EVENT_MASK, WINDOW_EVENT_MASK, WINDOW_FOCUS_EVENT_MASK, WINDOW_STATE_EVENT_MASK, consumed, id

Fields inherited from class java.util.EventObject

source

Constructor Summary

PaintEvent(Component source, int id, Rectangle updateRect)
Constructs a PaintEvent object with the specified source component and type.

Method Summary

Rectangle
getUpdateRect()
Returns the rectangle representing the area which needs to be repainted in response to this event.
String
paramString()
Returns a parameter string identifying this event.
void
setUpdateRect(Rectangle updateRect)
Sets the rectangle representing the area which needs to be repainted in response to this event.

Methods inherited from class java.awt.event.ComponentEvent

getComponent, paramString

Methods inherited from class java.awt.AWTEvent

consume, getID, isConsumed, paramString, setSource, toString

Methods inherited from class java.util.EventObject

getSource, toString

Methods inherited from class java.lang.Object

clone, equals, extends Object> getClass, finalize, hashCode, notify, notifyAll, toString, wait, wait, wait

Field Details

PAINT

public static final int PAINT
The paint event type.
Field Value:
800
Usages and Demos :

View More Examples of PaintEvent.PAINT
   1:       {
   2:       case PaintEvent.PAINT:
   3:       case PaintEvent.UPDATE:
   4:         ...
   5:         
   6:           if (id == PaintEvent.PAINT)
   7:         awtComponent.paint (g);
   8:           else
   9:         awtComponent.update (g);

View Full Code Here
   1:   {
   2:     q.postEvent (new PaintEvent (awtComponent, PaintEvent.PAINT,
   3:                  new Rectangle (x + insets.left, 
   4:                         y + insets.top, 
   5:                         width, height)));

View Full Code Here
   1:   {
   2:     eventQueue.postEvent (new PaintEvent (awtComponent, PaintEvent.PAINT,
   3:                       new Rectangle (x, y, width, height)));
   4:   }

View Full Code Here
   1:     XExposeEvent expose = new XExposeEvent(anyEvent);
   2:     PaintEvent pe = new PaintEvent(src, PaintEvent.PAINT,
   3:                    expose.getBounds());
   4:     return pe;
   5:   }

View Full Code Here
   1:     eq.postEvent(new WindowEvent(w, WindowEvent.WINDOW_OPENED));
   2:     eq.postEvent(new PaintEvent(w, PaintEvent.PAINT,
   3:                                 new Rectangle(0, 0, w.getWidth(),
   4:                                               w.getHeight())));

View Full Code Here

PAINT_FIRST

public static final int PAINT_FIRST
Marks the first integer id for the range of paint event ids.
Field Value:
800

PAINT_LAST

public static final int PAINT_LAST
Marks the last integer id for the range of paint event ids.
Field Value:
801

UPDATE

public static final int UPDATE
The update event type.
Field Value:
801
Usages and Demos :

View More Examples of PaintEvent.UPDATE
   1:       case PaintEvent.PAINT:
   2:       case PaintEvent.UPDATE:
   3:     {
   4:       try 
   5:         {

View Full Code Here
   1:       case PaintEvent.PAINT:
   2:       case PaintEvent.UPDATE:
   3:       {
   4:         ...
   5:     PaintEvent updateEvent = new PaintEvent(component,
   6:                         PaintEvent.UPDATE,
   7:                         new Rectangle(x, y, w, h));
   8:     getXToolkit().queue.postEvent(updateEvent);
   9:   }

View Full Code Here
   1:         NotifyingEvent(Component c) {
   2:             super(c, PaintEvent.UPDATE, null);
   3:         }
   4:         synchronized boolean isDispatched() { return dispatched; }
   5:         synchronized boolean isEventQEmpty() { return qEmpty; }

View Full Code Here
   1:     {
   2:       case PaintEvent.UPDATE:
   3:       case PaintEvent.PAINT:
   4:         ...
   5:                     g.clipRect(clip.x, clip.y, clip.width, clip.height);
   6:                     peerPaint(g, e.getID() == PaintEvent.UPDATE);
   7:                   }
   8:         ...
   9:       {
  10:         PaintEvent ev = new PaintEvent(awtComponent, PaintEvent.UPDATE,
  11:                                        new Rectangle(x, y, width, height));

View Full Code Here

Constructor Details

PaintEvent

public PaintEvent(Component source,
                  int id,
                  Rectangle updateRect)
Constructs a PaintEvent object with the specified source component and type.

Note that passing in an invalid id results in unspecified behavior. This method throws an IllegalArgumentException if source is null.

Parameters:
source - the object where the event originated
id - the event type
updateRect - the rectangle area which needs to be repainted
Throws:
IllegalArgumentException - if source is null
Usages and Demos :

View More Examples of PaintEvent(Component source,int id,Rectangle updateRect)
   1:       g.dispose();
   2:       PaintEvent pev = new PaintEvent(awtWindow, PaintEvent.PAINT, r);
   3:       Toolkit.getDefaultToolkit().getSystemEventQueue().postEvent(pev);
   4:       break;
   5:     case KeyPress.CODE:

View Full Code Here

Method Details

getUpdateRect

public Rectangle getUpdateRect()
Returns the rectangle representing the area which needs to be repainted in response to this event.
Usages and Demos :

View More Examples of getUpdateRect()
   1: import jp.ujihara.java.awt.event.MouseWheelListener;
   2: import jp.ujihara.java.awt.event.PaintEvent;
   3: import jp.ujihara.java.awt.event.WindowEvent;
   4:         ...
   5:         return newEvent;
   6:       case PaintEvent.PAINT:
   7:         ...
   8:       case PaintEvent.UPDATE:
   9:         return coalescePaintEvents((PaintEvent) existingEvent,
  10:         ...
  11:   {
  12:     Rectangle r1 = queuedEvent.getUpdateRect();

View Full Code Here

paramString

public String paramString()
Returns a parameter string identifying this event. This method is useful for event-logging and for debugging.
Overrides:
paramString in interface ComponentEvent
Returns:
a string identifying the event and its attributes

setUpdateRect

public void setUpdateRect(Rectangle updateRect)
Sets the rectangle representing the area which needs to be repainted in response to this event.
Parameters:
updateRect - the rectangle area which needs to be repainted