⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 elevatorcasestudy.java

📁 JAVA 多线程不可多得的好例子
💻 JAVA
字号:
// ElevatorCaseStudy.java
// Application with Elevator Model, View, and Controller (MVC)
package com.deitel.jhtp5.elevator;

// Java core packages
import java.awt.*;

// Java extension packages
import javax.swing.*;

// Deitel packages
import com.deitel.jhtp5.elevator.model.*;
import com.deitel.jhtp5.elevator.view.*;
import com.deitel.jhtp5.elevator.controller.*;

public class ElevatorCaseStudy extends JFrame {

   // model, view and controller
   private ElevatorSimulation model;
   private ElevatorView view;
   private ElevatorController controller;

   // constructor instantiates model, view, and controller
   public ElevatorCaseStudy()
   {
      super( "Deitel Elevator Simulation" );

      // instantiate model, view and ,controller
      model = new ElevatorSimulation();
      view = new ElevatorView();
      controller = new ElevatorController( model );

      // register View for Model events
      model.setElevatorSimulationListener( view );

      // add view and controller to ElevatorSimulation
      getContentPane().add( view, BorderLayout.CENTER );
      getContentPane().add( controller, BorderLayout.SOUTH );

   } // end ElevatorSimulation constructor

   // main method starts program
   public static void main( String args[] )
   {
      // instantiate ElevatorSimulation
      ElevatorCaseStudy caseStudy = new ElevatorCaseStudy();
      caseStudy.setDefaultCloseOperation( EXIT_ON_CLOSE );
      caseStudy.pack();
      caseStudy.setVisible( true );
   }
}


 

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -