printerdriver.java

来自「只是一个简单模拟操作系统」· Java 代码 · 共 62 行

JAVA
62
字号
/* * PrinterDriver.java * * Created on 2006年3月18日, 下午2:32 * * To change this template, choose Tools | Options and locate the template under * the Source Creation and Management node. Right-click the template and choose * Open. You can then make changes to the template in the Source Editor. */package os.iodevice;/** * * @author Vernkin */import javax.swing.*;import os.process.*;public class PrinterDriver implements Runnable{    final private String name = "[PrinterDriver]";        IOGate ig;    MyProcess currentPro;        //display area    JLabel proInfo;    JTextArea printerOut;    JTextArea commonOut;        /** Creates a new instance of PrinterDriver */    public PrinterDriver(JLabel proInfo,JTextArea printerOut,JTextArea commonOut) {        ig = IOGate.getInstance("Printer");        this.proInfo = proInfo;        this.printerOut = printerOut;        this.printerOut.append(name+" Activated"+"\n");        this.commonOut = commonOut;        this.commonOut.append(name+" Detected"+"\n");        currentPro = null;    }        public void run(){        while(true){            if(ig.driverHaveTask()){                currentPro = ig.getProcess();                currentPro.setStatus("Printing");                currentPro = ig.getProcess();                proInfo.setText("Current Process Infomation : Name "+currentPro.getName()+"  ID:"+currentPro.getID());                printerOut.append(name+currentPro+((char)ig.getData())+"\n");                commonOut.append(name+currentPro+"[printing......]"+"\n");                ig.driverFinishWork();                currentPro = null;             }else{                ig.rest(2000);             }//end else          }      }    }

⌨️ 快捷键说明

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