A JavaFX-based drag-and-drop circuit simulation tool designed for interactive electrical learning and prototyping. Built for the CSC311 course, it supports real-time visualization of electrical flow, cloud-based project saving, and a user-friendly interface.
- Interactive Components: Drag and drop batteries, lightbulbs, wires, and switches.
- Real-Time Simulation: Visualize power flow across connected components.
- Smart Port System: Components snap together using logical ports for clear connectivity.
- Project Persistence:
- Save/load projects to Azure Blob Storage.
- Project metadata and user accounts stored in MySQL.
- Dark Mode & Grid Overlay: Toggle visual preferences for cleaner UI.
- Profile Management: Update personal info and change passwords.
- Guided Tutorial: Learn how to build circuits with integrated tooltips and examples.
- JavaFX – UI and drag-and-drop interface
- MySQL – User and project metadata persistence
- Azure Blob Storage – Save circuit JSON files
- Gson – JSON serialization of circuit layout
- FXML – Declarative layout for views
- Java 21+ – Modern Java features (records, pattern matching)
Users Table
CREATE TABLE IF NOT EXISTS circuitUsers (
id VARCHAR(200) PRIMARY KEY,
email VARCHAR(200) UNIQUE,
password VARCHAR(200),
firstname VARCHAR(200),
lastname VARCHAR(200),
dob DATETIME DEFAULT CURRENT_TIMESTAMP
);Projects Table
CREATE TABLE IF NOT EXISTS projects (
id VARCHAR(200) PRIMARY KEY,
name VARCHAR(100),
description TEXT,
user_id VARCHAR(200),
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
last_modified TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
blob_reference VARCHAR(255)
);- Container:
circuitprojects - Blob Format: JSON (circuit structure: components, wires, positions, connections)
- Defined in:
BlobDbOpps.java - Automatically creates container if missing.
{
"components": [
{ "id": "bat1", "type": "Battery", "x": 120, "y": 240 },
{ "id": "bulb1", "type": "Lightbulb", "x": 300, "y": 240 }
],
"wires": [
{
"startComponentId": "bat1",
"startPortIndex": 1,
"endComponentId": "bulb1",
"endPortIndex": 0,
"startX": 140, "startY": 250,
"endX": 320, "endY": 250
}
]
}- Java JDK 21+
- IntelliJ IDEA (recommended)
- MySQL server (Azure-hosted preferred)
- Clone the repo:
git clone https://github.com/your-repo/circuit-simulator.git
- Set database credentials in
DbOpps.java. - Set Azure credentials in
BlobDbOpps.java. - Launch from
Login.javaormainmenu.fxml.


