Skip to content

shazee-04/gym-management-system

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

46 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Java Build Database

GMS Preview

A desktop application for managing a fitness center, built with Java Swing and styled with FlatLaf. It covers member and trainer management, attendance tracking, workout plans, equipment inventory, product sales, payments, and one-click JasperReports. The app persists data in MySQL and ships with an Ant-based build for easy packaging.

Features

  • Modern dark UI using FlatLaf (Mac Dark theme)
  • Authentication and role gating via Login form
  • Dashboard with live KPIs
    • Members
    • Trainers
    • Daily logins
    • Monthly payments
    • Product sales
  • Modules/panels
    • Members, Trainers, Workout Plans, Attendance, Progress Tracking
    • Equipment, Other Products, Payment Records
    • Generate Reports (JasperReports) and Database Backup
  • Reporting
    • Members, Trainers, Attendance, Payments, Product Sales, Equipment
    • JasperReports viewer integration
  • Database
    • MySQL (via Connector/J), centralized helper in connection.MySQL
    • One-click backup using mysqldump (configurable)
  • Utilities
    • Custom dialogs, rounded corners, logging, date/time helpers, regex validation

Requirements

  • Java Development Kit (JDK) 21
  • Apache Ant (if building from CLI)
  • MySQL Server 8.x
  • A MySQL user with sufficient privileges to read/write and perform backups (if using Backup)

Optional (recommended): NetBeans IDE (the project contains NetBeans metadata and uses CopyLibs).

Technologies

  • Java Swing (UI)
  • FlatLaf 3.6 (Look and Feel)
  • MySQL Connector/J 8.4.0
  • JasperReports 6.21.3 and companions
  • Apache Commons (BeanUtils, Collections, Collections4, Digester, Logging)
  • JSVG 1.4.0 (SVG rendering), JCalendar 1.4, Barbecue (barcodes)
  • iText/OpenPDF (PDF support in reports)
  • Apache Ant (build), NetBeans project layout

All third-party jars are vendored under lib/ and wired in nbproject/project.properties.

Installation

1. Clone the repo

git clone https://github.com/shazee-04/gym-management-system.git
cd gym-management-system

2. Configure the database connection

This project expects a configuration file on the application classpath: resources/db.properties . Create it before running the app.

Example resources/db.properties:

db.host=localhost
db.port=3306
db.name=gms
db.user=root
db.password=secret

# Full paths to the MySQL client tools (used for backup)
db.mysql_path=C:\\Program Files\\MySQL\\MySQL Server 8.0\\bin\\mysql.exe
db.mysqldump_path=C:\\Program Files\\MySQL\\MySQL Server 8.0\\bin\\mysqldump.exe

Place the file under your project/classpath (for NetBeans, put it in resources/ and ensure it's on the compile/run classpath; when packaging, include it in the jar or next to it and adjust your run classpath accordingly).

For backup, a MySQL client option file is used. Create src/resources/mysql.cnf (git-ignored) with:

[client]
user=root
password=secret
host=localhost
port=3306

Note: Backup uses --defaults-extra-file=src/resources/mysql.cnf. If you run from a packaged jar or a different working directory, ensure the relative path remains valid or adjust the code/path.

3. Prepare the database schema

Use the bundled SQL file (recommended):

  • A ready-made schema script is included at backups/gms-database-init.sql.

  • It creates the database gms and all required tables (no seed data).

  • Ensure your db.properties uses db.name=gms.

  • Run it via MySQL Workbench (File > Open SQL Script… > Execute) or from the CLI:

    # PowerShell (adjust mysql.exe path and credentials as needed)
    & "C:\Program Files\MySQL\MySQL Server 8.0\bin\mysql.exe" -u root -p < .\backups\gms-database-init.sql

After running, manually insert at least one admin user into the admin table (since the script does not include seed data) and toggle its active status via the status reference.

Build and Run

Option A: NetBeans (recommended)

  • Open the project folder in NetBeans.
  • Ensure your Project Properties target Java Platform is JDK 21.
  • Right-click the project > Clean and Build.
  • Run. NetBeans will set main.class=gui.SplashSceen and copy required jars to dist/lib/.

Option B: Ant (CLI)

# Windows PowerShell
ant clean jar
java -jar .\dist\Gym_Management_System.jar

Ant will produce dist/Gym_Management_System.jar and dist/lib/ with all runtime dependencies (via NetBeans CopyLibs). The manifest will reference the correct Class-Path and Main-Class.

Usage

  • Launch the application. You'll see a splash, then the login form.
  • Log in using credentials stored in the admin table (with status join for active users).
  • After login, the main interface provides:
    • Sidebar navigation across modules
    • Dashboard metrics automatically aggregated from the database
    • Generate reports via the Generate Reports panel
    • Backup data button to create a timestamped SQL file under backups/

Reports come from compiled Jasper templates located under src/report/.

Configuration

  • Main class: gui.SplashSceen (set in nbproject/project.properties)
  • DB configuration: resources/db.properties (classloader-loaded by connection.MySQL)
  • Backup option file: src/resources/mysql.cnf
  • UI theme: FlatLaf Mac Dark (FlatMacDarkLaf.setup() in SplashSceen/MainInterface)

You can switch to a different FlatLaf theme by replacing the setup call.

Repository Structure

.
β”œβ”€ build.xml                         # Ant entry point; imports nbproject/build-impl.xml
β”œβ”€ manifest.mf                       # Manifest skeleton; main is injected at build
β”œβ”€ README.md                         # Project documentation
β”œβ”€ backups/                          # Database scripts and backups
β”‚  └─ gms-database-init.sql          # Creates `gms` DB and all required tables
β”œβ”€ lib/                              # Vendored third-party jars (UI, DB, reports, utils)
β”‚  β”œβ”€ absolutelayout/                # NetBeans layout helper
β”‚  β”œβ”€ CopyLibs/                      # NetBeans CopyLibs task jar
β”‚  β”œβ”€ hamcrest/, junit_4/            # Test libraries (JUnit 4 + Hamcrest)
β”‚  └─ *.jar                          # FlatLaf, JasperReports, MySQL, Commons, etc.
β”œβ”€ nbproject/                        # NetBeans project metadata and wiring
β”‚  β”œβ”€ build-impl.xml                 # Generated Ant targets
β”‚  β”œβ”€ project.properties             # Classpath, main class, JDK, dist settings
β”‚  └─ ...
β”œβ”€ src/
β”‚  β”œβ”€ connection/
β”‚  β”‚  └─ MySQL.java                  # Central JDBC connection + queries + backup
β”‚  β”œβ”€ gui/                           # Top-level frames and entry points
β”‚  β”‚  β”œβ”€ SplashSceen.(java|form)     # Splash, sets FlatLaf, shows Login
β”‚  β”‚  β”œβ”€ LoginForm.(java|form)       # Auth; opens MainInterface
β”‚  β”‚  └─ MainInterface.(java|form)   # Main window, cards for panels, dashboard
β”‚  β”œβ”€ img/                           # UI assets (e.g., banner.svg, favicon)
β”‚  β”œβ”€ panels/                        # Feature modules
β”‚  β”‚  β”œβ”€ *.panel.(java|form)         # Members, Trainers, Attendance, etc.
β”‚  β”‚  └─ dialog/                     # Dialogs (ManageMember, ManageTrainer, Attendance)
β”‚  β”œβ”€ report/                        # Compiled JasperReports templates (.jasper)
β”‚  β”œβ”€ resources/                     # Local-only config (examples provided)
β”‚  β”‚  β”œβ”€ db.properties.example       # Copy to db.properties and edit
β”‚  β”‚  └─ mysql.cnf.example           # Copy to mysql.cnf and edit
β”‚  β”œβ”€ util/                          # UI and system utilities (icons, logging,rounding, time)
β”‚  └─ validation/                    # `Regex` patterns helper
└─ .gitignore                        # Ignores db.properties and mysql.cnf

Contributing

  • Fork the repo and create a feature branch.
  • Keep UI code organized under the appropriate panel or dialog.
  • Follow the existing logging pattern (use util.LoggerUtil).
  • Write small, focused commits.
  • Open a Pull Request against main with a clear description and screenshots when UI changes are involved.

If you plan to introduce database schema changes, include migration notes or SQL.

Documentation

  • Code is organized by feature. Start at gui.MainInterface to understand navigation and KPIs.
  • Reporting entry-points live in panels.GenerateReportsPanel and .jasper templates under src/report/.
  • Database helper lives in connection.MySQL.

Acknowledgements

  • FlatLaf for a clean, modern look
  • JasperReports for reporting
  • MySQL Connector/J for JDBC connectivity
  • Apache Commons, JSVG, JCalendar, Barbecue, iText/OpenPDF and others shipped in lib/

Notes

  • License: No explicit license is provided. If you intend to use or redistribute this code, please open an issue to clarify licensing.
  • Security: The current login and queries use string concatenation; consider parameterized queries and password hashing before production use.
  • Backup file path uses a relative src/resources/mysql.cnf. Adjust for packaged deployments.
  • Database initialization: The provided backups/gms-database-init.sql sets up schema only. Add an initial admin in admin and required lookup rows in status/membership as needed.

About

⬜🟧 Fully functional Gym Management System made with Java Swing.

Topics

Resources

Stars

Watchers

Forks

Languages