A lightweight Java Swing application for tracking habits, viewing completion streaks, and visualizing progress with a calendar heatmap.
- Create, edit, and delete habits
- Daily logging with one-click toggle for today and yesterday
- Streak tracking (current + longest)
- Scrollable log history per habit
- Heatmap calendar panel for visual streak overview
- Lightweight embedded SQLite persistence (single file
habits.db) - Theming utilities (
LightTheme) for future style expansion - Scaled UI based on a runtime factor for HiDPI displays
habit-tracker/
src/
com/crizz/zenith/
App.java # Entry point (bootstraps UI + scaling)
dao/ # Data access layer (SQLite + in-memory flags)
model/ # POJOs representing domain entities
service/ # Business logic & streak computation
ui/ # Swing UI components (frame, heatmap, theme)
lib/ # Third-party libraries (e.g., sqlite-jdbc)
bin/ # (Ignored) Compiled classes output
habits.db # Local user data (ignored by git)
README.md # This documentation
.gitignore
Layered design:
- Model:
Habit,HabitLog - DAO:
HabitDAO,HabitLogDAO+HabitLogDAOImpl,DatabaseManager - Service:
HabitService(habit CRUD + date marking),HabitLogService(logs + streak logic) - UI:
HabitTrackerFrame,HeatmapPanel,LightTheme - Bootstrap:
App
The DAOs isolate SQL + persistence. Services provide higher-level operations and enforce invariants (e.g., avoiding duplicate date marks). UI remains thin and event-driven.
Current streak walks logs backward from today, counting consecutive completion days. Longest streak scans chronologically, accumulating ranges of sequential days.
HeatmapPanel queries completion dates in a range and renders a simple streak calendar block grid. (See code for details.)
- Java 17+ (tested) — earlier versions supporting text blocks (Java 15+) likely work
- SQLite JDBC driver (included in
lib/sqlite-jdbc-<version>.jar)
From the project root (habit-tracker):
# Compile
javac -d bin -cp lib/sqlite-jdbc-3.50.3.0.jar $(find src -name "*.java")
# Run
java -cp bin:lib/sqlite-jdbc-3.50.3.0.jar com.crizz.zenith.App(Use ; instead of : as the classpath separator on Windows.)
- Default user is created automatically: username "dude", password "dude".
- Start app → Login screen → you can login with default credentials or register a new user.
- Each user has separate habits and logs.
A launch configuration is already present under .vscode/launch.json. Open the folder in VS Code and press F5 (ensure Java extensions are installed).
The SQLite file habits.db is created in the working directory if missing. It's ignored by git to prevent leaking personal activity data. Deleting it resets the app state.
Planned additions:
- JUnit 5 tests for streak calculations (
HabitLogService) - DAO integration tests using in-memory SQLite (
jdbc:sqlite::memory:)
LightTheme centralizes gradient tokens (currently used minimally). Additional palette strategies or dark mode can extend this pattern.
Add a screenshot named screenshot-main.png under docs/images/ (already referenced above). Example command (Linux):
# While app is running
import -window "Zenith Habit Tracker" docs/images/screenshot-main.png(Or use your OS screenshot tool.)
- Fork the repo
- Create a feature branch:
git checkout -b feature/some-improvement - Commit changes:
git commit -m "Add some improvement" - Push branch:
git push origin feature/some-improvement - Open a Pull Request
Coding style: keep classes focused, avoid static coupling in services, and prefer constructor injection for new dependencies (already used in HabitLogService).
| Issue | Cause | Fix |
|---|---|---|
SQLite driver missing |
JAR not on classpath | Ensure -cp lib/sqlite-jdbc-*.jar in compile & run |
| UI very large/small | Scale factor | Adjust SCALE constant in App.java |
| No habits persist | Deleted habits.db |
This resets state intentionally |
Add a license of your choice (e.g., MIT) by creating a LICENSE file. Current code is unlicensed (all rights reserved by default).
- Dark theme + custom color picker
- Export/import habits + logs (JSON)
- Weekly / monthly analytics panel
- Notification / reminder integration (desktop or email)
- Multi-device sync (switch to remote backend)
- SQLite JDBC driver (Xerial)
- Swing — still alive and productive for fast desktop tools
Happy tracking and stay consistent! 🌱
