Java Reference
In-Depth Information
1. User Interaction
2. Listener Notifies
3. Delegates to
Figure
Canvas
SWT Event
Dispatcher
LWS
6. Validates Invalid Figures,
Paints Dirty Region
Update
Manager
Root Figure
5b. Revalidates and
Marks Root as Invalid
4. Dispatches Figure
Events
5a. Requests Repaint
of Dirty Region
Content Root
Figure
Figure
Figure
Figure 9-3 Draw2D interaction sequence
9.1.3 Painting
The following sequence illustrates the process of figure painting.
paint() —This method is declared on the interface and kicks off the
painting process. First, properties are set on the graphics that children
would inherit, including font and background and foreground color. Then
the graphics state is pushed so that just these inherited settings can be
restored when painting children. Next, the following methods are called:
paintFigure() —The figure paints itself, although figures are not
required to paint at all. A simple form of painting is to fill in the bound-
ing box with the figure's background color.
paintClientArea() —The client area is where children appear. This
method should apply any changes to the graphics that affect only chil-
dren, such as coordinate system modifications and translating the graphics
 
Search WWH ::




Custom Search