我正嘗試使用LWUIT創建啓動畫面。我想要一個表單加載並顯示文本和圖像5秒鐘,然後繼續下一個表單。我有一個代碼,但未能顯示圖像。類和圖像一起存儲在同一個包中。相反,它顯示一個錯誤。代碼無法顯示圖像 - java.io.IOException在Image.createImage
java.io.IOException
可能是什麼問題?這是代碼
package tungPackage;
import com.sun.lwuit.Display;
import com.sun.lwuit.Form;
import com.sun.lwuit.Image;
import com.sun.lwuit.Label;
import javax.microedition.midlet.MIDlet;
public class photoMidlet extends MIDlet {
public void startApp() {
Display.init(this);
try {
Form splashscreen = new Form();
// Label splashText = new Label("Baldy");
Image image = Image.createImage("/splash.png");
Label pictureLabel = new Label(image);
splashscreen.addComponent(pictureLabel);
splashscreen.show();
} catch (Exception ex) {
Form x = new Form("ERROR");
String y = ex.toString();
Label g = new Label(y);
x.addComponent(g);
x.show();
}
}
public void pauseApp() {
}
public void destroyApp(boolean unconditional) {
}
}
顯示的例外信息是什麼? – 2012-04-06 07:06:54
將其捕獲,然後顯示在另一個表單x上,如代碼所示。 – sammyukavi 2012-04-06 07:08:06
你應該在你的問題中指定這個消息 – 2012-04-06 07:09:01