Objectives
The IBM AWT Samples are provided as examples of how to use the Java AWT classes in the
Java class libraries.
Time Required
Running any one AWT Sample will take only a few minutes. To thoroughly
explore and experiment with changing the code, you may want to set aside 30 minutes for
each sample with which you want to work.
Before You Begin
To add sample project to your workspace:
The IBM Java Examples project will be added to your workspace, and the source code will be compiled. The project includes the Hanoi sample, the IBM Java AWT samples, and several Visual Composition Editor samples.
Description
The IBM Java AWT samples provide a large variety of programs that demonstrate how
to use the Java AWT classes. The applets demonstrate animation, text manipulation,
GUI programming, resource file usage, and event handling.
Each AWT sample can be run on its own as an application. Alternatively, you can run the launcher application and launch one or more of the samples from the launcher interface.
See List of AWT Samples.
Running the Samples
To run a particular AWT sample:
To launch samples from the launcher program:
The samples programs have instructions on what to do with the interface.
If the programs cannot find resource files, set the class path by doing the following steps:
To learn more about the AWT classes and how they work, experiment with the sample classes by changing the code or writing your own programs, using the samples as guides. If you make changes and later want to restore the original samples, simply replace the edition in the workspace with the original edition in the repository.
Sample | Description |
AwtBlueGreenGem | Demonstrates animation, keyboard events, mouse-dragging, and use of resource files. |
AwtBorderLayoutUseCase | Demonstrates the border layout manager, menus, and buttons. |
AwtButtonUseCase | Demonstrates button actions. |
AwtCardLayoutUseCase | Demonstrates the card layout manager and button events. |
AwtCheckboxUseCase | Demonstrates the use of checkboxes. |
AwtChoiceUseCase | Demonstrates the use of drop-down lists. |
AwtClock | Demonstrates programming an analog clock. |
AwtClipboardUseCase | Demonstrates use of the clipboard. |
AwtColorBrowser | Demonstrates use of Color. |
AwtColorQueryChangeExample | Demonstrates changing colors of GUI components and mouse actions. |
AwtCursorUseCase | Demonstrates using and changing cursor styles. |
AwtDelegationEventExample | Demonstrates the event delegation model (all events are printed to the Console). |
AwtDefaultColorText | Demonstrates querying the default color of a component. |
AwtDialogUseCase | Demonstrates using dialogs. |
AwtEventExample | Demonstrates handling events (all events are printed to the Console). |
AwtFileDialogUseCase | Demonstrates using the file dialog. |
AwtFlowLayoutUseCase | Demonstrates the flow layout manager. |
AwtFocusTraversalTest | Demonstrates focus change events. |
AwtGridLayoutUseCase | Demonstrates the grid layout manager. |
AwtInputEventTest | Demonstrates processing key and mouse events. |
AwtLabelUseCase | Demonstrates the use of labels. |
AwtLightweightExample | Demonstrates the Lightweight API. |
AwtLineTests | Demonstrates line operations. |
AwtListUseCase | Demonstrates the use of lists. |
AwtMenuUseCase | Demonstrates the use of menus. |
AwtPaintUpdateExample | Demonstrates paint operations. |
AwtPropertiesUseCase | Demonstrates getting properties (such as system properties). |
AwtRectangleTests | Demonstrates rectangle operations. |
AwtRollingOTI | Demonstrates animation, mouse and key events, and using resource files. |
AwtSynthesizeKeyEventTest | Demonstrates synthesizing key events. |
AwtSynthesizeMouseEventTest | Demonstrates synthesizing mouse events. |
AwtScrollbarUseCase | Demonstrates using scrollbars. |
AwtScrollPaneUseCase | Demonstrates using scroll panes. |
AwtShowImage | Demonstrates working with images (scaling, using filters). |
AwtSplitterPanelExample | Demonstrates using split panes. |
AwtTextAreaUseCase | Demonstrates working with text areas. |
AwtTextFieldUseCase | Demonstrates working with text fields. |