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

📄 loadanimator.java

📁 本j2me坦克游戏是在Nokia平台下开发的
💻 JAVA
字号:
/* This file was created by Nokia Developer's Suite for J2ME(TM) */import javax.microedition.lcdui.*;public class LoadAnimator extends Canvas implements Runnable{    private int Total_Size = 1;    private int Current_Size = 0;    private Thread thread;    private Display display;    private Displayable nextPage;    private boolean bAnimatorStarted = false;    private boolean bAnimatorNoFinish = false;    public static int Fresh_Frequency; //刷新频率    private boolean isover;    private int sw = getWidth();    private int sh = getHeight();    private int rectnum = 7;    private int rectw;    private int rx1,ry1,rx2,ry2,strx,stry,bigx,bigy;    private int nownum = 0;	public LoadAnimator(  Display ds, Displayable _next )	{		super( );        display = ds;        nextPage = _next;        bAnimatorStarted = false;        bAnimatorNoFinish = false;        Fresh_Frequency = 100;        isover = false;        rectw = sw/(rectnum*2+1);        ry1 = (sh-rectw)/2-10;        rx1 = rectw;        ry2 = (sh-rectw)/2-10;        rx2 = rectw;        bigx = 0;        bigy = (sh-rectw)/2-10-rectw;        strx = 30;        stry = ry1 + rectw + 50;	}    public void run() {        while(bAnimatorNoFinish){            try {                thread.sleep(Fresh_Frequency);                repaint();            }            catch (InterruptedException e) {}        }    }    protected void paint(Graphics g) {        //设置背景颜色        g.setColor(255,255,255);        g.fillRect(0,0,sw,sh);        //显示进度        g.setColor(0,0,0);        g.drawRect(bigx,bigy,(rectnum*2+1)*rectw,3*rectw);        for(int i = 0;i<rectnum;i++){        	g.setColor(0,0,0);            g.drawRect(rx1, ry1, rectw,rectw);            rx1+=rectw*2;        }        rx1 = rectw;        for(int j = 0;j<nownum;j++){        	g.setColor(0,0,0);     	 	g.fillRect(rx2,ry2,rectw,rectw);  	     	rx2+=rectw*2;        }        rx2 = rectw;        g.setColor(0,0,0);   //   g.setFont(Font.getFont(Font. FACE_PROPORTIONAL,  Font.STYLE_BOLD, Font.SIZE_MEDIUM));        g.drawString("游戏装载中,请稍候……",strx,stry,g.LEFT|g.TOP);        //版权信息        g.setColor(128,128,128);        g.drawString("版权所有",0,0,g.LEFT|g.TOP);        //结束        if(isover) {            display.setCurrent(nextPage);            bAnimatorNoFinish = false;        }    }    //启动    public void play() {        display.setCurrent(this);        thread = new Thread(this);        thread.start();        bAnimatorStarted = true;        bAnimatorNoFinish = true;    }    public void getnownum(int m){    	nownum = m;    }    public void isover(){    	isover = true;    }}

⌨️ 快捷键说明

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