An interactive graphical elevator simulation written in Java with a Swing GUI. The simulation implements the LOOK algorithm to schedule elevator sweeps, manage travel direction, and coordinate passenger boarding and drop-offs.
Ensure your files are placed in a subdirectory named java-elevator:
java-elevator/
├── Building.java
├── Button.java
├── DestButton.java
├── Direction.java
├── Elevator.java
├── Floor.java
├── FloorRequest.java
├── Lobby.java
├── MiddleFloor.java
├── Rider.java
├── Roof.java
├── UpDownButton.java
└── Visualizer.java
- Java Development Kit (JDK): Version 8 or higher is required to compile and run the application.
Follow these steps in your terminal or command prompt:
-
Navigate to the project subdirectory:
cd path/to/java-elevator -
Compile all source files:
javac *.java -
Run the visualizer:
java Visualizer
- Call an Elevator: Click the ▲ (UP) or ▼ (DOWN) buttons on the left side of any floor line. This spawns a passenger and calls the elevator to that floor.
- Select Destination: When a passenger boards, an interactive control panel pop-up will appear. Click a floor button on the panel to select their destination floor.
- LOOK Algorithm Sweeping: The elevator travels continuously in its active direction (UP or DOWN), dropping off occupants and picking up waiting passengers traveling in that same direction. It only reverses course when no requests remain ahead of it.
- Arrived Passengers: Once a passenger reaches their destination, they are marked Done and removed.
© Copyright 2026 Blake Rayvid. All rights reserved.
