Package org.jcsp.awt
Interface Paintable
- All Known Implementing Classes:
DisplayList
public interface Paintable
Active components may delegate their paint and update
methods to objects implementing this interface.
Description
Objects implementing Paintable may be passed to an Active component (such asActiveCanvas
). The Active component will
then register
with the Paintable object
and delegate to it its paint and update methods.
The Paintable object may either be passed statically
(via the component's setPaintable
method, before the component starts running) or dynamically
(via the component's
toGraphics/fromGraphics
channels).
Note: these operations are currently supported only for
ActiveCanvas
components.
A CSProcess may choose to implement Paintable itself and take
responsibility for its own painting/updating. However, this would break the JCSP
design pattern that the thread(s) of control within a running process have exclusive
access to the process state (since painting/updating is actually done by the
Java event thread). It is, therefore, better to delegate this task to
a different (and passive) object such as a DisplayList
.
- Author:
- P.H. Welch
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionvoid
This is the call-back delegated here by the registered Component.void
Register the Component that will delegate its paint and update methods here.void
This is the call-back delegated here by the registered Component.
-
Method Details
-
register
Register the Component that will delegate its paint and update methods here.- Parameters:
c
- the Component that will do the delegating.
-
paint
This is the call-back delegated here by the registered Component. It will normally be the JVM event thread that is making this call.- Parameters:
g
- the graphics context for the painting.
-
update
This is the call-back delegated here by the registered Component. It will normally be the JVM event thread that is making this call.- Parameters:
g
- the graphics context for the painting.
-