Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Assignment 4 : JavaFX Contact Form Objective Create a JavaFX application that simulates a simple contact form. The application should include labels, text fields for

Assignment 4: JavaFX Contact Form
Objective
Create a JavaFX application that simulates a simple contact form. The application should include
labels, text fields for user input, and buttons to submit or reset the form. This assignment will
help you understand the basics of JavaFX, including event handling, layout management, and
data validation.
Requirements
1. Layout: Use a GridPane layout to arrange the components in a form-like structure (Labels
on one column, text fields on the other column).
2. Components:
Labels: For each input field (Name, Email, Phone Number), there should be a
corresponding label. And a label to show massages when the input is invalid or when
the input is successful.
Text Fields: For user input, provide three text fields corresponding to the labels.
Buttons: Include two buttons - "Submit" and "Reset".
3. Event Handling:
Submit Button: On clicking the "Submit" button, validate the input data. If the data
is valid, display a confirmation message using a label. If the data is invalid, show an
error message in a label.
Reset Button: Clears all text fields and any error messages displayed.
4. Data Validation:
Name: Should not be empty.
Email: Must contain one '@' character.
Phone Number: Should only contain numbers and must be 8 digits long.
Instructions
1. Setup Your Project:
Create a new JavaFX project in your preferred IDE.
Ensure you have the JavaFX SDK set up correctly. Refer to the recording on Teams
to learn how to setup a JavaFX project on IntilliJ.
2. Design the UI (3 points):
Use a GridPane to layout your form. Add Label and TextField components for the
Name, Email, and Phone Number inputs.
Add "Submit" and "Reset" buttons at the bottom of the form.
3. Implement Event Handlers (5 points):
For the "Submit" button, add an event handler that checks if the input data is valid:
If all fields are valid, show a confirmation message in a label.
If any field is invalid, display an error message.
For the "Reset" button, clear all text fields and any displayed error messages.
4. Validate Data (2 points):
Implement methods to validate the Name, Email, and Phone Number fields according
to the requirements.
5. Test Your Application:
Ensure that the form correctly validates input and responds appropriately to the
"Submit" and "Reset" buttons

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Modern Database Management

Authors: Jeffrey A. Hoffer Fred R. McFadden

4th Edition

0805360476, 978-0805360479

More Books

Students also viewed these Databases questions

Question

Define procedural justice. How does that relate to unions?

Answered: 1 week ago