Skip to content

About

A lightweight Java digital clock with GUI and command-line support, built with Swing and Maven

Topics

Resources

Stars

0 stars

Watchers

1 watching

Forks

Latest commit

 

History

34 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 

Repository files navigation

DigitalClock

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.

Features

  • 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 UIType enum.
  • 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

Screenshots will be added soon.

Technologies

Technology Purpose
Java 25 Programming language
Maven Build and dependency management
Swing Graphical user interface
JUnit 5 Automated testing
Mockito Mocking dependencies in tests

Requirements

Before running DigitalClock, make sure you have:

  • Java JDK 25 or later
  • Git (optional, for cloning the repository)
  • Maven

Getting Started

1. Clone the repository

git clone https://github.com/timonexus/DigitalClock.git
cd DigitalClock

2. Build the project

On Windows:

mvn clean verify

On Linux and macOS:

mvn clean verify

3. Run the application

On Windows:

mvn exec:java

On Linux and macOS:

mvn exec:java

By default, the application starts using the command-line interface.

Choosing an Interface

DigitalClock supports two different interfaces.

The interface can be selected through the UIType enum.

Command-Line Interface

Clock clock = new Clock(UIType.CUI);
clock.startClock();

Graphical User Interface

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.

Project Structure

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/

Running Tests

To execute the automated test suite:

mvn test

On Windows:

mvn test

To run the full verification, including tests:

mvn clean verify

Roadmap

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

Contributing

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.

License

This project is licensed under the MIT License. See the LICENSE file for details.

Developed by Timonexus.

About

A lightweight Java digital clock with GUI and command-line support, built with Swing and Maven

Topics

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages