The SampleWindow class abstracts the interactive window for the sample Aglets. It encapsulates shared data (e.g. window components) and code (e.g. event handling). More specialized subclasses of SampleWindow are defined for every sample aglet which define specific window components, specialized event handling and complete layout of components. The reader should refer to these subclasses for complete description of the implementation of the interaction window of the sample aglets.
The shared components include an addressbook and a text field to specify a target address (_addressChooser), a text field for filename specification (_filepath) and two panels to display messages (_msgLine) and results (_result) of the "worker" aglet (see SampleAglet).
protected AddressChooser _addressChooser = new AddressChooser(); protected TextArea _result = new TextArea(); protected TextArea _msgLine = new TextArea(); protected TextField _filepath = new TextField(FIELD);
Other shared components are two control buttons, quit and go, used to dispose a sample aglet and create a new "worker" aglet, respectively.
protected Button _go = new Button("Go"); protected Button _quit = new Button("Quit");
In addition to shared window components, this class also defines several shared instance variables: the sample aglet (for applying callback methods like go), a GridBagLayout object and a pop up window (the PopUpMessageWindow class) for error message notifications. The constructor (SampleWindow) is always called by the constructors of the interaction window subclasses to initialize these variables.
All the methods are used to create and access different components of the interaction window.
The complete source code of the SampleWindow class is found here. However, the AddressChooser class (a pure Java class) is not part of the samples package and its source code is currently not available.