A simple, lightweight digital clock application built with Java.
DigitalClock provides two ways to display the current time: a graphical user interface (GUI) and a command-line interface (CUI). The project is designed with a modular structure, making it easy to understand, maintain and extend.
- Graphical User Interface (GUI) – Displays the current time in a fullscreen window.
- Command-Line Interface (CUI) – Displays the current time directly in the terminal.
- Selectable Interface – Choose between GUI and CUI using the
UITypeenum. - Real-Time Updates – Updates the displayed time every second.
- Modular Architecture – Separates clock logic, services and user interfaces.
- Automated Tests – Uses JUnit 5 to test application components.
Screenshots will be added soon.
| Technology | Purpose |
|---|---|
| Java 25 | Programming language |
| Maven | Build and dependency management |
| Swing | Graphical user interface |
| JUnit 5 | Automated testing |
| Mockito | Mocking dependencies in tests |
Before running DigitalClock, make sure you have:
- Java JDK 25 or later
- Git (optional, for cloning the repository)
- Maven
git clone https://github.com/timonexus/DigitalClock.git
cd DigitalClockOn Windows:
mvn clean verify
On Linux and macOS:
mvn clean verify
On Windows:
mvn exec:java
On Linux and macOS:
mvn exec:java
By default, the application starts using the command-line interface.
DigitalClock supports two different interfaces.
The interface can be selected through the UIType enum.
Clock clock = new Clock(UIType.CUI);
clock.startClock();
Clock clock = new Clock(UIType.GUI);
clock.startClock();
You can also use the default constructor:
Clock clock = new Clock();
clock.startClock();
The default constructor uses the command-line interface.
The application follows a modular structure:
src/
├── main/
│ └── java/
│ └── de/
│ └── timonexus/
│ └── digitalClock/
│ ├── Main.java
│ ├── backend/
│ │ └── Clock.java
│ ├── services/
│ │ └── ClockUIService.java
│ └── ui/
│ ├── CUI.java
│ ├── GUI.java
│ ├── UIType.java
│ └── UserInterfacesClock.java
└── test/
└── java/
└── de/
└── timonexus/
└── digitalClock/
To execute the automated test suite:
mvn test
On Windows:
mvn test
To run the full verification, including tests:
mvn clean verify
DigitalClock is currently under development.
Planned improvements include:
- Additional customization options
- Configurable time formats
- Improved graphical interface
- Additional automated tests
- Further improvements to application architecture
Contributions, suggestions and bug reports are welcome!
If you have an idea for improving DigitalClock or have found a problem, feel free to open an issue or submit a pull request.
When contributing, please keep the code clean, readable and consistent with the existing project structure.
This project is licensed under the MIT License. See the LICENSE file for details.
Developed by Timonexus.