The Digital Clock Application is a simple Java GUI application that displays the current time in a digital format.
The time is updated every second to reflect the current system time.
This project demonstrates basic Java Swing components and real-time updates using a Timer
.
- Real-Time Clock: Displays the current time in hours, minutes, and seconds.
- Automatic Update: The time updates every second to ensure accuracy.
- Java: Core language for the application.
- Swing: Java GUI toolkit used for creating the user interface.
- Timer: Used to update the clock every second.
- Java Development Kit (JDK): Ensure that you have JDK 8 or higher installed on your machine.
-
Clone the Repository:
git clone https://github.com/davidegrigioni/digitalclock.git cd digitalclock
-
Open the Project:
Open the project in your preferred Java IDE (e.g., IntelliJ IDEA, Eclipse).
-
Build and Run:
-
In IntelliJ IDEA:
- Open the
DigitalClock
class. - Click the
Run
button or useShift + F10
to execute the application.
- Open the
-
In Eclipse:
- Right-click on the
DigitalClock
class. - Select
Run As > Java Application
.
- Right-click on the
-
-
Launch the Application:
- Run the
DigitalClock
class to start the application.
- Run the
-
View Time:
- The application window will display the current time and update every second.
DigitalClock
Class:- Sets up the JFrame and layout.
- Uses
JLabel
to display the time. - Updates the time every second using a
Timer
.
updateClock()
:- Updates the time displayed on the JLabel using the current system time.
Feel free to fork the repository and submit pull requests with improvements or bug fixes.
This project is licensed under the MIT License. See the LICENSE file for details.
- Inspired by basic GUI programming concepts in Java.
- Utilizes Java Swing for creating a simple graphical user interface.
For any issues or questions, please open an issue in the repository or contact me directly.