Copyright (c) SEMM NL All rights reserved.
Author : Paul Hamaker. Part of JavaLessons.com

The gist.

If the button is clicked the first textfield is asked for the text it contains.

If this String doesn't start with an 'a', we request the keyboard focus for the textfield, so the user can correct it immediately .

For the user's convenience we set the caret at the start of the textfield .

The text in tf2 is checked likewise, if tf1's content has been approved.

The Label's text is set to indicate whether we approve or disapprove the user's input.