Skip to content

A JavaFX User Authentication System that allows users to register and log in. This application connects to a MySQL database using JDBC to manage user credentials securely and features input validation with user-friendly alerts.

License

Notifications You must be signed in to change notification settings

B-Acharekar/JavaFX-User-Authentication-System

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 

Repository files navigation

JavaFX Application Setup with Laragon and VS Code/Eclipse

This project demonstrates a simple JavaFX application with user registration and login functionality, designed using JavaFX and Scene Builder. The frontend is built with FXML and controls like TextField, Button, and more, and the backend handles user interactions like registering and logging in, with Laragon used as the recommended environment for MySQL.

Table of Contents


Prerequisites

Before you begin, ensure you have the following installed:


Installation

Setting up in Visual Studio Code

  1. Install the JDK:

  2. Install the Java Extension Pack:

    • Open VS Code.
    • Go to the Extensions tab (Ctrl + Shift + X), search for Java Extension Pack, and install it.
  3. Configure the JDK Path:

    • If the JDK isn't automatically detected, configure it manually:
      • Open Settings (Ctrl + ,).
      • Search for java.configuration.runtimes and configure the path to your JDK installation like this:
        "java.configuration.runtimes": [
          {
            "name": "JavaSE-11",
            "path": "C:/Program Files/Java/jdk-11",
            "default": true
          }
        ]
  4. Install JavaFX SDK:

    • Download the JavaFX SDK from JavaFX SDK.
    • Extract it and set it up in your project.
  5. Install Scene Builder:

    • Download and install Scene Builder from Gluon Scene Builder.
    • In VS Code, you can link FXML files to open with Scene Builder.

Setting up in Eclipse

  1. Install Eclipse:

  2. Install the JDK:

    • Download and install JDK 11 or above from Oracle JDK.
  3. Set up JDK in Eclipse:

    • Open Eclipse.
    • Navigate to Window > Preferences > Java > Installed JREs.
    • Add your installed JDK path (e.g., C:/Program Files/Java/jdk-11).
  4. Install JavaFX Plugin from Eclipse Marketplace:

    • Open Eclipse.
    • Go to Help > Eclipse Marketplace.
    • Search for e(fx)clipse in the marketplace and install it. This plugin provides tooling support for JavaFX, including FXML support.
    • Restart Eclipse after installation.
  5. Set up JavaFX SDK:

    • Download and install the JavaFX SDK from JavaFX SDK.
    • Add the JavaFX .jar files in the Build Path:
      • Right-click on your project > Build Path > Configure Build Path > Add External JARs > Select all .jar files in the lib folder of the JavaFX SDK.
  6. Install Scene Builder:

    • Download Scene Builder from Scene Builder to design your FXML files visually.
    • Set it up in Eclipse to open .fxml files automatically.

Running the Application

Visual Studio Code

  1. Ensure that your JavaFX SDK is properly configured in your project.
  2. Open the project in VS Code.
  3. Run your JavaFX application by executing:
    java --module-path <path_to_javafx_sdk> --add-modules javafx.controls,javafx.fxml -jar <your_jar_file>.jar

Eclipse

  1. Open the project in Eclipse.
  2. Right-click your Main Class (e.g., MON.java) and select Run As > Java Application.

Database Setup with Laragon

This project uses Laragon as the recommended development environment for MySQL. Follow these steps to set it up:

  1. Download and Install Laragon:

    • Download Laragon from the official website.
    • Install it and start the environment.
  2. Create MySQL Database:

    • Launch MySQL via Laragon. You can manage databases using phpMyAdmin.
    • Create a new database for your project:
      CREATE DATABASE account;
      USE account;
      CREATE TABLE user (
          id INT AUTO_INCREMENT PRIMARY KEY,
          username VARCHAR(50) NOT NULL,
          password VARCHAR(50) NOT NULL
      );
  3. Database Connection in Code:

    • In your JavaFX project, ensure that the database connection class (MON_database.java) connects to MySQL using JDBC. Example connection code:
      public class MON_database {
          public static Connection connectDB() {
              try {
                  String url = "jdbc:mysql://localhost:3306/account";
                  String user = "root";
                  String password = "";
                  Connection connection = DriverManager.getConnection(url, user, password);
                  return connection;
              } catch (SQLException e) {
                  e.printStackTrace();
                  return null;
              }
          }
      }
  4. MySQL Workbench (Optional):

    • If you prefer, you can use MySQL Workbench to manage your database, but Laragon’s built-in phpMyAdmin is more lightweight for quick testing.

Contributing

If you'd like to contribute to this project, feel free to submit a pull request or open an issue.


License

This project is licensed under the MIT License - see the LICENSE file for details.

About

A JavaFX User Authentication System that allows users to register and log in. This application connects to a MySQL database using JDBC to manage user credentials securely and features input validation with user-friendly alerts.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published