/**
打算做个足球类游戏
Football2007
@2007424
*/
/**
多个类,各自提交控制,注意资源
*/
//package com.sword;
import javax.microedition.midlet.MIDlet;
import javax.microedition.lcdui.*;
import javax.microedition.lcdui.game.GameCanvas;
import javax.microedition.lcdui.game.*;
import java.util.*;
import com.sword.FootballMenu;
public class Football2007 extends MIDlet{
Display d=Display.getDisplay(this);
public void startApp(){
System.out.println("ok");
new FootballMenu(d);
}
public void pauseApp(){}
public void destroyApp(boolean e){
notifyDestroyed();
}
}
/**
*/
package com.sword;
import javax.microedition.midlet.MIDlet;
import javax.microedition.lcdui.*;
import javax.microedition.lcdui.game.GameCanvas;
import javax.microedition.lcdui.game.*;
public class FootballMenu extends GameCanvas implements Runnable{
Display d;
private Sprite MainSprite;
public FootballMenu(Display d){
super(true);
start();
this.d=d;
d.setCurrent(this);
System.out.println("FootballMenu");
Thread t=new Thread(this);
t.start();
}
public void start(){
try{
MainSprite=new Sprite(Image.createImage("/2.png"),90,120);
}
catch(Exception e){}
Graphics g=getGraphics();
MainSprite.paint(g);
}
public void run(){
while(true){
Graphics g=getGraphics();
flushGraphics();
}
}
}
评论