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.
- 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)
- MySQL (via Connector/J), centralized helper in
- Utilities
- Custom dialogs, rounded corners, logging, date/time helpers, regex validation
- 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).
- 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.
git clone https://github.com/shazee-04/gym-management-system.git
cd gym-management-systemThis 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.exePlace 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=3306Note: 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.
Use the bundled SQL file (recommended):
-
A ready-made schema script is included at
backups/gms-database-init.sql. -
It creates the database
gmsand all required tables (no seed data). -
Ensure your
db.propertiesusesdb.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.
- 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.SplashSceenand copy required jars todist/lib/.
# Windows PowerShell
ant clean jar
java -jar .\dist\Gym_Management_System.jarAnt 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.
- Launch the application. You'll see a splash, then the login form.
- Log in using credentials stored in the
admintable (withstatusjoin 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/.
- Main class:
gui.SplashSceen(set innbproject/project.properties) - DB configuration:
resources/db.properties(classloader-loaded byconnection.MySQL) - Backup option file:
src/resources/mysql.cnf - UI theme: FlatLaf Mac Dark (
FlatMacDarkLaf.setup()inSplashSceen/MainInterface)
You can switch to a different FlatLaf theme by replacing the setup call.
.
ββ 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
- 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
mainwith a clear description and screenshots when UI changes are involved.
If you plan to introduce database schema changes, include migration notes or SQL.
- Code is organized by feature. Start at
gui.MainInterfaceto understand navigation and KPIs. - Reporting entry-points live in
panels.GenerateReportsPaneland.jaspertemplates undersrc/report/. - Database helper lives in
connection.MySQL.
- 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/
- 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.sqlsets up schema only. Add an initial admin inadminand required lookup rows instatus/membershipas needed.
