Focus States is a Java-based desktop productivity application that implements a Pomodoro-style focus timer with gamification elements. The application helps users improve concentration through timed focus sessions while rewarding them with virtual coins that can be used to unlock additional features.
- ๐ Customizable Timer: Set focus sessions from 1-60 minutes (default: 45 minutes)
- ๐ฌ Visual Feedback: Animated GIF displays showing current state (waiting/focusing)
- ๐ต Audio Management: Background music with mute/unmute functionality
- ๐ช Gamification System: Earn 10 coins for each completed session
- ๐ Unlockable Features: 9 different features that can be unlocked with earned coins
- ๐ Session Tracking: Statistics for total time, completed sessions, and earned coins
- โธ๏ธ Break Functionality: Pause and resume focus sessions
- ๐ฏ Clean GUI: Intuitive Swing-based user interface
- Language: Java SE 8+
- GUI Framework: Java Swing
- Audio: javax.sound.sampled API
- Development Environment: BlueJ IDE compatible
- Build System: Standard Java compilation
| Component | Responsibility | Key Methods |
|---|---|---|
FocusSystem |
Business logic, timer, audio, coins | startCountdown(), toggleMute(), unlockFeature() |
FocusFrame |
Main GUI window | handleStart(), handleBreak(), handleCancel() |
FocusRecapFrame |
Statistics and feature unlocking | handleLockUnlock(), statistics display |
CircularGIFPanel |
Visual feedback component | setGif(), paintComponent() |
FocusSystemListener |
Observer pattern interface | Event callback methods |
- Observer Pattern:
FocusSystemListenerinterface enables loose coupling between business logic and GUI - Model-View-Controller: Clear separation between
FocusSystem(Model), GUI classes (View), and event handlers (Controller)
- Java Version: Java SE 8 or higher
- Operating System: Cross-platform (Windows, macOS, Linux)
- Memory: Minimum 256 MB RAM
- Storage: ~60 MB for application and assets
# Navigate to project directory
cd "Focus States x1-preview"
# Compile all Java files
javac *.java
# Run the application
java FocusSystem- Open BlueJ IDE
- Open project folder containing Java files
- Right-click
FocusSystemclass - Select "void main(String[] args)"
- Launch the application
- Optional: Click SET button to adjust timer (1-60 minutes)
- Click START button to begin focus session
- Application displays focus animation and starts countdown
- Background music plays automatically (unless muted)
- Click Mute/Unmute button (top-right) to toggle background music
- Audio automatically starts during focus sessions
- Mute state persists until manually changed
- Click BREAK button during active session to pause
- Click BREAK button again to resume
- Or click CANCEL to abort session entirely
- Complete focus sessions to earn coins (10 coins per session)
- Click Home button to access Focus Recap window
- Click any Lock button to unlock features (10 coins each)
- Unlocked features display custom icons instead of lock symbol
- Total Time: Cumulative focus time across all completed sessions
- Total Focus: Number of successfully completed sessions
- Total Coins: Current coin balance (earned minus spent)
Focus States x1-preview/
โโโ FocusSystem.java # Core business logic and main method
โโโ FocusFrame.java # Main GUI window
โโโ FocusRecapFrame.java # Statistics and unlocking window
โโโ CircularGIFPanel.java # Custom GIF display component
โโโ FocusSystemListener.java # Observer interface
โโโ images/ # UI buttons and icons (required)
โ โโโ LOGO.png
โ โโโ StartBTN.png
โ โโโ BreakBTN.png
โ โโโ CancelBTN.png
โ โโโ Lock.png
โ โโโ Unlock1-9.png
โ โโโ ...
โโโ gifs/ # Animation assets (required)
โ โโโ waiting.gif
โ โโโ penguin.gif
โโโ musics/ # Audio files (required)
โ โโโ M5.wav
โโโ README.md # This file
- Images: 22+ PNG files for buttons, icons, and unlockables
- GIFs: 2 animation files for visual feedback
- Audio: 1 WAV file for background music
- Missing Assets: Application will display error messages if files not found
- Earning Rate: 10 coins per completed focus session
- Spending: 10 coins per feature unlock
- Features: 9 unlockable features (IDs 1-9)
- Persistence: In-memory storage (resets on application restart)
| Feature ID | Unlock Cost | Visual Asset | Status |
|---|---|---|---|
| 1-9 | 10 coins each | Unlock{ID}.png |
Tracked in boolean array |
- Timer displays correct initial value (45:00)
- Timer counts down every second when started
- Timer stops at 00:00 and shows completion message
- Custom time setting (1-60 minutes) works correctly
- Timer resets properly after completion or cancellation
- Background music plays during focus sessions
- Mute button toggles audio on/off
- Audio stops when session ends or is cancelled
- Mute button icon updates correctly
- All buttons respond to clicks
- Button visibility changes correctly based on state
- GIF animations switch between waiting and focus states
- Coin counter updates when sessions complete
- Focus Recap window opens and closes properly
- Lock buttons display correctly (locked/unlocked states)
- Unlock confirmation dialog appears
- Coins deduct properly when features unlocked
- Unlocked features show custom icons
- Insufficient coins shows error message
- Data Persistence: Application state resets on restart (coins, unlocked features)
- Asset Dependencies: Hard-coded file paths may cause issues if assets moved
- Audio Format: Limited to WAV format for background music
- Single Session Type: Only focus sessions, no break timer implementation
- Missing Assets: Application displays error messages but continues running
- Audio Initialization: Fails gracefully if audio system unavailable
- Timer Precision: May drift slightly over very long sessions
- Data Persistence: Implement file-based or database storage
- Multiple Timers: Add break timer and long break functionality
- Customization: User-selectable themes, sounds, and animations
- Statistics Enhancement: Historical data tracking and charts
- Notification System: System notifications for session completion
- Keyboard Shortcuts: Hotkey support for common actions
Pomodoro Timer App | Focus States ยฉ 2024
This project is part of an academic assignment and is intended for educational purposes.
Get focused, stay productive! ๐ฏ