background image

1.

import javax.swing.*; 

2.

import java.awt.*; 

3.

import java.util.*; 

4.

public class Hufan extends JFrame{ 

5.

static HuPanel hp; 

6.

public static void main(String[] args) { 

7.

new Hufan(); 

8.

9.

public Hufan(){ 

10.

hp=new HuPanel(); 

11.

this.add(hp); 

12.

this.setTitle("模拟电梯"); 

13.

this.setSize(

350

650

); 

14.

this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); 

15.

this.setVisible(true); 

16.

17.

18.

class HuPanel extends JPanel{ 

19.

DianTi dt; 

20.

Person ps; 

21.

public HuPanel(){ 

22.

init(); 

23.

dt=new DianTi(

45

0

); 

24.

//

 

启动电梯线程

25.

Thread t=new Thread(dt); 

26.

t.start(); 

27.

28.

public DianTi getDianTi(){