|
CSP for Java (JCSP) 1.0-rc4 |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
This enables general configuration of this component. Any object implementing this interface and sent down the configure channel to this component will have its configure method invoked on this component.
For example, to set the foreground/background colours, first define:
private class AppletColours implements ActiveApplet.Configure { private Color foreground = Color.white; private Color background = Color.black; public void setColour (Color foreground, Color background) { this.foreground = foreground; this.background = background; } public void configure (java.applet.Applet applet) { applet.setForeground (foreground); applet.setBackground (background); } }Then, construct an instance of AppletColours, set its foreground/background colours as required and send it down the configure channel when appropriate.
Note that an instance of the above AppletColours may have its colours reset and may be resent down the channel. To ensure against race-hazards, construct at least two instances and use them alternately. Acceptance of one of them by the ActiveApplet means that it has finished using the other and, therefore, the other may be safely reset. So long as the configure channel is unbuffered, completion of the write method means that the message has been read (i.e. accepted) by the receiving process.
Method Summary | |
void |
configure(Applet applet)
|
Method Detail |
public void configure(Applet applet)
applet
- the Applet being configured.
|
CSP for Java (JCSP) 1.0-rc4 |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |