📄 printerdriver.java
字号:
/* * 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 + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -