Answered step by step
Verified Expert Solution
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 : 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
Layout: Use a GridPane layout to arrange the components in a formlike structure Labels
on one column, text fields on the other column
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".
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.
Data Validation:
Name: Should not be empty.
Email: Must contain one @ character.
Phone Number: Should only contain numbers and must be digits long.
Instructions
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.
Design the UI 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.
Implement Event Handlers 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.
Validate Data points:
Implement methods to validate the Name, Email, and Phone Number fields according
to the requirements.
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
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started