A Java Swing desktop application that compares time intervals, validates user input, and determines interval relationships using object-oriented programming principles, generic classes, and immutable objects.
This project demonstrates object-oriented software design by implementing a graphical desktop application capable of comparing time intervals and validating time input. The application was built using Java Swing and emphasizes reusable design through generic programming, immutable objects, custom exceptions, and comprehensive input validation.
- Compare two time intervals
- Detect overlapping intervals
- Detect sub-interval relationships
- Detect disjoint intervals
- Determine whether a specific time falls within one or both intervals
- Comprehensive input validation
- Custom checked exceptions
- Graphical user interface built with Java Swing
This project demonstrates several core object-oriented programming concepts:
- Generic classes (
Interval<T>) - Immutable objects
- Encapsulation
- Comparable interface
- Custom checked exceptions
- Separation of responsibilities across multiple classes
The application's class relationships are illustrated below.
- Java
- Java Swing
- Object-Oriented Programming
- Generics
- Git
The application was tested against a variety of valid and invalid input scenarios.
- Overlapping intervals
- Sub-interval detection
- Disjoint intervals
- Invalid hour values
- Invalid minute values
- Invalid meridian values
- Non-numeric input
- Start time occurring after end time
Clone the repository:
git clone https://github.com/jcrosbybuilds/java-time-interval-checker.gitOpen the project in IntelliJ IDEA (or another Java IDE).
Compile and run:
Project4.java
java-time-interval-checker/
├── src/
│ ├── Interval.java
│ ├── Time.java
│ ├── InvalidTime.java
│ └── Project4.java
├── screenshots/
├── README.md
├── LICENSE
└── .gitignore
This project strengthened my understanding of:
- Generic programming in Java
- Immutable class design
- Object-oriented software architecture
- Java Swing GUI development
- Exception handling
- Input validation
- Comparable interface
- Git and GitHub project management
Potential enhancements include:
- Calendar date support
- Drag-and-drop scheduling
- Save and load interval data
- Unit testing with JUnit
- Maven or Gradle build support
- Dark mode interface




