⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 result.java

📁 this small program about implement barcodes in mobile phone
💻 JAVA
字号:
package barcodereader;import java.io.IOException;import javax.microedition.lcdui.Canvas;import javax.microedition.lcdui.Graphics;import javax.microedition.lcdui.Image;public class Result extends Canvas{    public int wordnumber, wordindex;    private BarcodeReader barcodereader;    private Image background, textarea, bottommenu;        public Result(BarcodeReader br) {        barcodereader = br;                try{            background = Image.createImage(getClass().getResourceAsStream(                "/image/takepictureresultbackground.PNG"));            textarea = Image.createImage(getClass().getResourceAsStream(                "/image/textarea.PNG"));            bottommenu = Image.createImage(getClass().getResourceAsStream(                "/image/resultbottommenu.PNG"));        }        catch(IOException ioe) {            ioe.printStackTrace();        }                wordindex = 0;    }        public void paint(Graphics g) {        int a;                barcodereader.graphics.setColor(0, 0, 0);        barcodereader.graphics.fillRect(0, 0, barcodereader.bufferheight,             barcodereader.bufferwidth);        barcodereader.graphics.drawImage(background, 0, 0,             Graphics.LEFT | Graphics.TOP);        barcodereader.graphics.drawImage(textarea, 5, 5,             Graphics.LEFT | Graphics.TOP);        barcodereader.graphics.drawImage(bottommenu, 0, 200,             Graphics.LEFT | Graphics.TOP);                for(a=0;a<6;a++) {            if((a+wordindex)<wordnumber) {                barcodereader.graphics.drawString(barcodereader.mainmenu.pictureprocess.processor.word[a+wordindex],                     15, (35+(a*20))+((20-barcodereader.fontheight)/2),                     Graphics.LEFT | Graphics.TOP);            }        }                g.setColor(0, 0, 0);        g.fillRect(0, 0, barcodereader.width, barcodereader.height);        g.drawImage(barcodereader.background, barcodereader.halfwidth,             barcodereader.halfheight, Graphics.HCENTER | Graphics.VCENTER);        g.drawImage(barcodereader.buffer, barcodereader.halfwidth,             barcodereader.halfheight, Graphics.HCENTER | Graphics.VCENTER);    }        public void keyPressed(int keyCode) {        if(keyCode==49) {            barcodereader.mainmenu.setFullScreenMode(true);            barcodereader.display.setCurrent(barcodereader.mainmenu);        }        else if((keyCode==-1)||(keyCode==50)) {            wordindex--;            if(wordindex<0) {                wordindex = 0;            }                        repaint();        }        else if((keyCode==-2)||(keyCode==56)) {            wordindex++;            if(wordindex>wordnumber-1) {                wordindex = wordnumber-1;            }                        repaint();        }    }}

⌨️ 快捷键说明

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