public class

RepaintArea

extends Object
java.lang.Object
   ↳ sun.awt.RepaintArea

Class Overview

The RepaintArea is a geometric construct created for the purpose of holding the geometry of several coalesced paint events. This geometry is accessed synchronously, although it is written such that painting may still be executed asynchronously.

Summary

Public Constructors
RepaintArea()
Constructs a new RepaintArea
Public Methods
synchronized void add(Rectangle r, int id)
Adds a Rectangle to this RepaintArea.
synchronized void constrain(int x, int y, int w, int h)
Constrains the size of the repaint area to the passed in bounds.
boolean isEmpty()
void paint(Object target, boolean shouldClearRectBeforePaint)
Invokes paint and update on target Component with optimal rectangular clip region.
synchronized void subtract(int x, int y, int w, int h)
Marks the passed in region as not needing to be painted.
String toString()
Returns a string representation of the object.
Protected Methods
void paintComponent(Component comp, Graphics g)
Calls Component.paint(Graphics) with given Graphics.
void updateComponent(Component comp, Graphics g)
Calls Component.update(Graphics) with given Graphics.
[Expand]
Inherited Methods
From class java.lang.Object

Public Constructors

public RepaintArea ()

Constructs a new RepaintArea

Public Methods

public synchronized void add (Rectangle r, int id)

Adds a Rectangle to this RepaintArea. PAINT Rectangles are divided into mostly vertical and mostly horizontal. Each group is unioned together. UPDATE Rectangles are unioned.

Parameters
r the specified Rectangle
id possible values PaintEvent.UPDATE or PaintEvent.PAINT

public synchronized void constrain (int x, int y, int w, int h)

Constrains the size of the repaint area to the passed in bounds.

public boolean isEmpty ()

public void paint (Object target, boolean shouldClearRectBeforePaint)

Invokes paint and update on target Component with optimal rectangular clip region. If PAINT bounding rectangle is less than MAX_BENEFIT_RATIO times the benefit, then the vertical and horizontal unions are painted separately. Otherwise the entire bounding rectangle is painted.

Parameters
target Component to paint or update

public synchronized void subtract (int x, int y, int w, int h)

Marks the passed in region as not needing to be painted. It's possible this will do nothing.

public String toString ()

Returns a string representation of the object. In general, the toString method returns a string that "textually represents" this object. The result should be a concise but informative representation that is easy for a person to read. It is recommended that all subclasses override this method.

The toString method for class Object returns a string consisting of the name of the class of which the object is an instance, the at-sign character `@', and the unsigned hexadecimal representation of the hash code of the object. In other words, this method returns a string equal to the value of:

 getClass().getName() + '@' + Integer.toHexString(hashCode())
 

Returns
  • a string representation of the object.

Protected Methods

protected void paintComponent (Component comp, Graphics g)

Calls Component.paint(Graphics) with given Graphics.

protected void updateComponent (Component comp, Graphics g)

Calls Component.update(Graphics) with given Graphics.