java微波炉程序代码_微波炉模拟应用程序(帮朋友的同学做的一个java选修课大作业)...

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);

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值