This project is a simple GUI application written in Java using Swing. It provides a basic login form with fields for a username and password, and buttons for submission and exit.
-
Input fields for username and password.
-
Validation of username and password input.
-
Feedback message for successful login or input errors.
-
Exit button to close the application.
-
Compile the Java source code:
``` javac Gui.java ```
-
Run the compiled Java program:
``` java Gui ```
-
The GUI window will appear, allowing you to enter a username and password.
-
Enter a username in the "Name" field. The username must not be empty and must only contain alphanumeric characters.
-
Enter a password in the "Password" field. The password must also not be empty and must only contain alphanumeric characters.
-
Click the "Enter" button to submit the login form. If the input is valid, a "Logged Successfully!" message will appear.
-
Click the "Exit" button to close the application.
-
Gui.java
: The main class containing the GUI logic. -
Gui()
: The constructor that sets up the GUI components and their behavior. -
name
: A JTextField for the username input. -
pass
: A JPasswordField for the password input. -
msg
: A JLabel for displaying messages to the user. -
error
: A boolean flag indicating if there is an input error. -
main(String[] args)
: The main method that starts the application. -
Input validation for the username and password fields.
-
Action listeners for the "Enter" and "Exit" buttons.
Upon running the application, you will see a window similar to this:
Here is a README.adoc file for your Java GUI project:
adoc Copy code = Simple Login GUI Application
This project is a simple GUI application written in Java using Swing. It provides a basic login form with fields for a username and password, and buttons for submission and exit.
-
Input fields for username and password.
-
Validation of username and password input.
-
Feedback message for successful login or input errors.
-
Exit button to close the application.
-
Compile the Java source code:
``` javac Gui.java ```
-
Run the compiled Java program:
``` java Gui ```
-
The GUI window will appear, allowing you to enter a username and password.
-
Enter a username in the "Name" field. The username must not be empty and must only contain alphanumeric characters.
-
Enter a password in the "Password" field. The password must also not be empty and must only contain alphanumeric characters.
-
Click the "Enter" button to submit the login form. If the input is valid, a "Logged Successfully!" message will appear.
-
Click the "Exit" button to close the application.
-
Gui.java
: The main class containing the GUI logic. -
Gui()
: The constructor that sets up the GUI components and their behavior. -
name
: A JTextField for the username input. -
pass
: A JPasswordField for the password input. -
msg
: A JLabel for displaying messages to the user. -
error
: A boolean flag indicating if there is an input error. -
main(String[] args)
: The main method that starts the application. -
Input validation for the username and password fields.
-
Action listeners for the "Enter" and "Exit" buttons.
Upon running the application, you will see a window similar to this:
Name
[ your_name ] Password [ your_password ] [Enter] [Exit]
Enter your username and password, then click "Enter" to log in or "Exit" to close the application.