当前页面: 开发资料首页 → J2ME 专题 → 一个,无法显示的问题,请指教!
一个,无法显示的问题,请指教!
摘要: 一个,无法显示的问题,请指教!
一个,无法显示的问题,请指教!
public class zhucdd extends GameCanvas implements Runnable{
private Thread t;
private Graphics GameGraphics;
private Image haida; //海大图标
public zhucdd(){
super(false);
setFullScreenMode(true);
this.GameGraphics= getGraphics();
try{
haida = Image.createImage("/haida.png");
}catch(Exception e){
System.out.println("Error!can not load imange!");
}
}
protected synchronized void keyPressed(int keyCode){
}
void render(Graphics g){
g.setClip(0,0,176,208);
g.setColor(0x000000);
g.fillRect(0,0,176,208);
g.setColor(0xff00ff);
g.drawString("画面片",5, 5,Graphics.TOP|Graphics.LEFT); //无显示
g.drawImage(haida, 10, 60, Graphics.LEFT | Graphics.TOP);//无显示
System.out.println("看是否在运行!"); //这个在运行
}
public void start(){
t=new Thread(this);
t.start();
System.out.println("开始");
}
public void run(){
while(true){
render(GameGraphics);
}
}
}
晕
不是这个显示不了,所有的都干不了!!
---------------------------------
GameGraphics是空的,你让他怎么画??
加入flushGraphics到while(true)里面去
看来我们得做细!有时候做细的就是厉害的!
二当家的,谢谢!