Chapter 6: Creating a Form Validation Application


 Download CD Content

The Java API provides the javax. speech and javax.speech.synthesis packages to develop an application to check the validity of field values specified by an end user in a form.

This chapter describes how to develop a Form Validation application, which converts the validation error text and confirmation message text to speech by using the javax.speech and javax.speech.synthesis packages . This application provides a user interface that contains a blank user information form. The application validates the values provided by an end user in the different fields of the form to check for errors and reads out the validation error text. If the end user enters valid values in the specified fields, the Form Validation application reads out the confirmation message text.

Architecture of the Form Validation Application

The Form Validation application allows end users to listen to the validation error text in the user information form. When an end user clicks the Save button, the application converts the validation error text to speech.

The Form Validation application uses the following files:

  • FormValidation.java: Allows end users to enter the user information form. This file also checks whether or not the information specified by an end user is correct.

  • SpeakFormValidation.java: Converts the validation error text to speech.

Figure 6-1 shows the architecture of the Form Validation application:

click to expand: this figure shows the files that the form validation application uses and the sequence in which the application uses them.
Figure 6-1: Architecture of the Form Validation Application

The FormValidation.java file provides end users with the user information form, which contains various labels, text boxes, combo boxes, and the Save and Close buttons . This file allows end users to fill the user information form and checks for errors in the form. The FormValidation.java file passes the validation errors to the SpeakFormValidation.java file.

When an end user clicks the Save button, the FormValidation.java file calls the SpeakFormValidation.java file to convert the validation errors passed by the FormValidation.java file to speech.




Java InstantCode. Developing Applications using Java Speech API
Java InstantCode. Developing Applications using Java Speech API
ISBN: N/A
EAN: N/A
Year: 2004
Pages: 46

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net