import java.awt.*;
import java.awt.event.*;
public class wbl extends Thread implements ActionListener//wbl父类为线程类并申明接口准备处理窗口消息
{
static Frame frame_main=new Frame("微波炉模拟应用程序");//程序主框架
static Panel window=new Panel();//模拟微波炉的窗口
static Panel display=new Panel();//微波炉LED显示区
static Label time=new Label();//LED时间显示区
static Label flag=new Label();//时间设定下标显示区
static Label statue=new Label();//微波炉当前状态显示区
static Button but_begin=new Button("开始");//开始按钮
static Button but_end=new Button("停止");//停止按钮
static Button but_1=new Button("1");//一下为数字键
static Button but_2=new Button("2");
static Button but_3=new Button("3");
static Button but_4=new Button("4");
static Button but_5=new Button("5");
static Button but_6=new Button("6");
static Button but_7=new Button("7");
static Button but_8=new Button("8");
static Button but_9=new Button("9");
static Button but_0=new Button("0");
static Button but_timeset=new Button("设定时间");//时间设定按钮
static wbl w=new wbl();//主类实例
static int num[]=new int[4];//记录四个显示时间的数字
static int i=0,total=0;//i为时间设定时候的循环变量,total为微波炉加热时候的剩余加热总秒数
static boolean ifsettime=false,iftimeready=false,ifrunning=false;
//三个状态量分别表示:是否在设定时间、时间是否设定成功、微波炉是否在加热状态
static void setflag()//时间设定时LED时间显示下标设定函数
{
if(i==0) flag.setText(" △");//设定下标
else if(i==1) flag.setText(" △");
else if(i==2) flag.setText(" △");
else if(i==3) flag.setText(" △");
else flag.setText("");
}
public void run()//线程体的run()方法
{
while(total--!=0)
{
try
{
time.setText(""+total/60/10+total/60%10+":"+total%60/10+total%60%10);