Java Reference
In-Depth Information
to the client area. This method also clips the graphics to the region where
children are allowed to appear.
paintChildren() —Now that the client area is set up, children are
painted. After each child paints, the graphics state is restored to the
incoming state so that children do not overwrite the inherited graphics
settings from the parent.
paintBorder() —Finally, the figure paints decorations that should
appear on top of the children. If a border has been set on the figure, it
paints now.
Figures are composed in trees, structurally speaking, so they are painted
by traversing the tree in depth-first order. As an example, consider the tree in
Figure 9-4 and the Z-order depicted in the corresponding image to the right.
1
1
6
2
6
1
2 3
2
2
3
6
3
3
3
4
4
5
Figure 9-4
Figure composition
Children within figures cannot paint outside their parent's bounds. Clipping
occurs while figures are painted and is cumulative for the entire parent hierarchy.
Figure 9-5 is a simple figure hierarchy and shows the result of clipping on its
rendition.
1
2
3
Figure 9-5
Figure clipping
 
Search WWH ::




Custom Search