/*
*http://blog.programfan.com/blog.asp?author=qq14923349
*程序之巢制作 @@七星彩模拟程序1.0版本
*如果有图片
*图片存在rec目录下,记得在存之前把格式转换成png,具体方法是:
1,点击开始
2,附件
3,图画板
4,打开图片
5,另存为(可以存作PNG了,不要改后续名,否则运行不了)
6,其他工具,可以选用PS,或者ACDSEE等等改
*/
import javax.microedition.midlet.MIDlet;
import javax.microedition.lcdui.*;
import javax.microedition.lcdui.game.GameCanvas;
import javax.microedition.lcdui.game.*;
import java.util.*;
public class Qixingcai extends MIDlet
{
public void startApp(){
new Wave(Display.getDisplay(this)).start();
}
public void pauseApp(){}
public void destroyApp(boolean e){}
class Wave extends GameCanvas implements Runnable{
private Display display;
private int number[]=new int[7];
private Random rand;
private int Xbackground,Ybackground;
private boolean Runonce=true;
public Wave(Display d){
super(true);
display=d;
display.setCurrent(this);
}
private void start(){
try{
rand=new Random();
}
catch(Exception e){
}
Thread t=new Thread(this);
t.start();
}
public void run(){
Graphics g=getGraphics();
while(Runonce){
update();
shake();
draw(g);
Runonce=false;
try{
Thread.sleep(100);
}
catch(Exception e){}
}
}
private void update()
{
int keyState=getKeyStates();
if((keyState&LEFT_PRESSED)!=0)
{
Runonce=true;
}
else if((keyState&RIGHT_PRESSED)!=0)
{
Runonce=true;
}
if((keyState&FIRE_PRESSED)!=0)
{
Runonce=true;
}
}
//--------------------------------
private void shake(){
for(int i=0;i<7;i++){
number[i]=Math.abs(rand.nextInt())%10;
System.out.println(""+number[i]);
}
}
//--------------------------------
private void draw(Graphics g){
g.setColor(0xffffff);
g.fillRect(0,0,getWidth(),getHeight());
g.setColor(0x000000);
g.drawString("海南私彩开奖模拟程序",20,20,Graphics.TOP|Graphics.LEFT);
for(int i=0;i<7;i++)
{
g.drawString(" "+number[i],10+i*10,40,Graphics.TOP|Graphics.LEFT);
}
g.setColor(0x00ff00);
g.drawString("本程序由剑2008制作",20,60,Graphics.TOP|Graphics.LEFT);
g.drawString("qq14923349",20,80,Graphics.TOP|Graphics.LEFT);
g.drawString("v1.0版本",20,100,Graphics.TOP|Graphics.LEFT);
flushGraphics();
}
}
}
//程序之巢制作 @@七星彩模拟程序1.0版本
评论