-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathElevatorCaseStudy.java
37 lines (37 loc) · 1.25 KB
/
ElevatorCaseStudy.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
package com.deitel.jhtp5.elevator;
import java.awt.*;
import javax.swing.*;
//Deitelpackages
import com.deitel.jhtp5.elevator.model.*;
import com.deitel.jhtp5.elevator.view.*;
import com.deitel.jhtp5.elevator.controller.*;
public class ElevatorCaseStudyextendsJFrame{
// model, view and controller
private ElevatorSimulation model;
private ElevatorView view;
private ElevatorController controller;
// constructor instantiates model, view, and controller
public class ElevatorCaseStudyextendsJFrame{
private ElevatorSimulation model;
private ElevatorView view;
private ElevatorController controller;
public ElevatorCaseStudy()
{
super( "Deitel Elevator Simulation" );
model = new ElevatorSimulation();
view = new ElevatorView();
controller = new ElevatorController( model );
model.setElevatorSimulationListener( view );
getContentPane().add( view, BorderLayout.CENTER );
getContentPane().add( controller, BorderLayout.SOUTH );
} // end ElevatorCaseStudy constructor 41
// main method starts program
public static void main( String args[] )
{
// instantiate ElevatorCaseStudy
ElevatorCaseStudy simulation = new ElevatorCaseStudy();
simulation.setDefaultCloseOperation( EXIT_ON_CLOSE );
simulation.pack();
simulation.setVisible( true );
}
}