awtExt examples
The examples source files on this page demonstrate the awtExt event handling
mechanism provided via the method callbacks. These examples are
based on the test programs included with the JDK.
BorderTest
Description:
Border Test demonstrates awtExt Buttons invoking user
defined methods via a callback mechanism. Here is the
source code
for the BorderTest window.
ChoiceTest
Description:
ChoiceTest demonstrates awtExt Choice buttons, (as well as a few
regular buttons) invoking user
defined methods via a callback mechanism.
Here is the
source code
for the ChoiceTest window.
CardTest
Description:
CardTest demonstrates awtExt buttons in a CardLayout invoking user
defined methods via a callback mechanism.
Here is source :
CardTest.java and
CardPanel.java
for the CardTest window.
ListTest
Description:
ListTest demonstrates a List controlled via user defined methods.
The list has 2 callback methods registered in its eventDispatch object.
Each button on the bottom of the window allows you to add, delete, clear,
select, deselect list items. Enter the item's label in the textfield
and then press one of the buttons. Each of these buttons invokes a user
registered method. An awtExt.Checkbox controls the list's
single/multiple selection mechanism.
Here is the
source code
for the ListTest window.
MenuTest
Description:
MenuTest demonstrates menus invoking user defined methods. Also shows
how to control event propagation so that an event could be handled
anywhere in the container hierarchy. All menuItems 'consume' the
ACTION_EVENT, with the exception of the 'vier' menu item, which
allows the ACTION_EVENT to propagate upward. User defined methods
are registered with MenuItems, Menus, and the MenuBar. In the java
console you will see that all menu selections, with the exception
of 'vier', fire only one user registered method. The 'vier'
selection, fires registered methods on the MenuItem, Menu and the
MenuBar level.
Here is the
source code
for the MenuTest window.
ScrollbarTest
Description:
ScrollbarTest demonstrates 2 scrollbars invoking user defined methods.
Each scrollbar has 1 callback method registered with it.
Note: JDK Beta-2 scrollbars are somewhat broken, so they
don't respond to repeat events. The next release of the JDK
Should fix this problem.
Here is the
source code
for the ScrollbarTest window.
TextAreaTest
Description:
TextAreaTest demonstrates how to control keyboard input
in a TextArea. Two methods are registered with the TextArea's
eventDispatch object, one method for KEY_ACTION events and one
for KEY_PRESS events. The KEY_PRESS event handler method is a simple
filter that toggles the case of a letter. The KEY_ACTION event handler
method toggles the letters' case back if the funtcion key F5 is pressed.
Buttons on the bottom of the window control a few aspects of the
TextArea, such as clearing it, resetting it, and printing its content.
Note: selecting text programmatically is broken in this JDK release.
Here is the
source code
for the TextAreaTest window.
TextFieldTest
Description:
TextFieldTest demonstrates how to control keyboard input
in a TextField. Two methods are registered with the phone number
TextField's eventDispatch object, one method for KEY_ACTION events
and one for KEY_PRESS events. The KEY_PRESS event handler method is a
simple filter that only accepts numeric chars and the '-' chars.
The KEY_ACTION event handler method simply prints to stdout that
it was invoked.
Buttons on the bottom of the window control a few aspects of the
TextFields, such as clearing , resetting , and printing their content.
Note: selecting text programmatically is broken in this JDK release
Here is the
source code
for the TextFieldTest window.