Java me 未在midlet中显示图像
我是新来的。我有一个小问题;请看下面的代码,并告诉我,如果我做错了什么,因为图像没有显示。我把它做得很小,所以它应该适合,但它没有显示。我有图像显示在其他屏幕上,但这个主midlet不会。代码如下:Java me 未在midlet中显示图像,java-me,Java Me,我是新来的。我有一个小问题;请看下面的代码,并告诉我,如果我做错了什么,因为图像没有显示。我把它做得很小,所以它应该适合,但它没有显示。我有图像显示在其他屏幕上,但这个主midlet不会。代码如下: import java.io.IOException; import javax.microedition.midlet.*; import javax.microedition.lcdui.*; /** * @author jay */ public class WShop extends
import java.io.IOException;
import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;
/**
* @author jay
*/
public class WShop extends MIDlet implements CommandListener {
/* Declare display variables*/
private Form mainForm;
private Display display;
private Command OK,Exit,wView, mView, myView;
/* */
Categories categories = new Categories(this);
Image image;
public WShop() {
/* initialize Screen and Command buttons that will
be used when the application starts in the class constructor*/
mainForm = new Form("Wind Shopper");
OK = new Command("OK", Command.OK, 2);
Exit = new Command("Exit", Command.EXIT, 0);
wview= new Command("wview", Command.OK, 0);
mview= new Command("mview", Command.OK, 0);
try {
/* retrieving the main image of the application*/
image = Image.createImage("/main.png");
} catch (IOException ex) {
ex.printStackTrace();
}
mainForm.addCommand(OK);
mainForm.addCommand(Exit);
mainForm.addCommand(wView);
mainForm.addCommand(mView);
mainForm.setCommandListener(this);
}
public void startApp() {
/* checks to see if the display is currently empty
and then sets it to the current screen */
if (display == null) {
display = Display.getDisplay(this);
}
display.setCurrent(mainForm);
}
/* paused state of the application*/
public void pauseApp() {
}
/* Destroy Midlet state*/
public void destroyApp(boolean unconditional) {
}
提前谢谢。在我看来,你好像忘记了
表单。append()
你的图像添加到表单。在我看来,你好像忘记了表单。append()
你的图像添加到表单。我感到既愚蠢又羞愧,我简直不敢相信我忘记了,我一直看着它。非常感谢。我觉得自己既愚蠢又羞耻,真不敢相信我竟然忘了这么做,我一直看着它。非常感谢你。