Coders Packet

Client Feedback Form using Java Swing in Java

By Parthvi Mayurkumar Patel

In this post, we shall create a survey form using Java Swing and perform form validation in Java. Form Validation displays appropriate error messages when any condition is violated.

This project uses Java Swing which is a GUI(graphical user interface) framework that helps in creating components such as buttons, text fields, checkboxes etc.

The project consists of 2 Java classes:-

1.  Clientform - It creates a JFrame using Java Swing along with other GUI components such as radio buttons, text fields, checkboxes, buttons etc. It also contains a method called actionperformed which programs every button and performs the required form validation.

2. Mainclass- It contains the main method

 

The constructor designs the layout of the form by creating and placing each component to its given location with appropriate labels. 

The actionperformed method assures that users don't submit the form without filling in their Names and Email addresses. It also validates the email address entered by the user by matching patterns using a regex. An error message is displayed if any of these conditions are violated.

Finally, a copy of all the responses entered by the user are displayed in a separate message.

 

To Run:-

Keep all files in the same folder, and simply run Mainclass.

 

Output:-

Form validation

Copy of responses

Download project

Reviews Report

Submitted by Parthvi Mayurkumar Patel (parthvi)

Download packets of source code on Coders Packet