org.jcsp.awt
Interface ActiveApplet.Configure
- Enclosing class:
- ActiveApplet
public static interface ActiveApplet.Configure
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.
configure
void configure(Applet applet)
- Parameters:
applet
- the Applet being configured.
Copyright © 1996-2012. All Rights Reserved.