首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >图像不在midlet中显示

图像不在midlet中显示
EN

Stack Overflow用户
提问于 2010-04-15 03:06:02
回答 1查看 209关注 0票数 1

我是新来的。我有一个小问题;PLease看看下面的代码,告诉我我是否做错了什么,因为图像没有显示。我已经把它做得很小了,所以它应该适合它,但它不显示。我有图像显示在其他屏幕上,但这个主midlet不会。代码如下:

代码语言:javascript
复制
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) {
    }

提前谢谢。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2010-04-15 17:43:36

在我看来,你忘了把你的图片Form.append()到你的表单上了。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/2640262

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档