首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > 编程 >

JB9+WTK2.0,java.lang.InstantiationException:Class not a MIDlet错误

2012-12-20 
JB9+WTK2.0,java.lang.InstantiationException:Class not a MIDlet异常!点击右边红色标题查看本文完整版:J

JB9+WTK2.0,java.lang.InstantiationException:Class not a MIDlet异常!
点击右边红色标题查看本文完整版:JB9+WTK2.0,java.lang.InstantiationException:Class not a MIDlet异常!

JB 9 + WTK2.0
? 最基本的程序可以运行...
?
? 出现异常代码如下:
? import javax.microedition.lcdui.*;
? import javax.microedition.midlet.*;
? public class GraphicsTestCanvas1 extends Canvas
? {
? public void paint(Graphics g)
? {
? ? g.setColor(255,250,0);
? ? //g.setGrayScale(4);
? ? g.fillRect(0,0,getWidth(),getHeight());
? ? int color = g.getColor() ;
? ? int displaycolor = g.getDisplayColor(g.getColor()) ;
? ? System.out.println("目前画面的颜色为:"+Integer.toHexString(color));
? ? System.out.println("目前画面的红色为:"+g.getRedComponent());
? ? System.out.println("目前画面的绿色为:"+g.getGreenComponent());
? ? System.out.println("目前画面的蓝色为:"+g.getBlueComponent());
? ? System.out.println("目前画面的显示颜色为:"+Integer.toHexString(displaycolor));
? ? System.out.println("画面为:"+g.getGrayScale()+"灰度");
? }
? }
? \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\Exception\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
? C:\WTK20\bin\emulator.exe -classpath "D:\Save\JAVA\wtk_006\classes;" -Xdevice:DefaultColorPhone -Xdescriptor:"D:\Save\JAVA\wtk_006\jad-temp\GraphicsTestCanvas1.jad"
? Running with storage root DefaultColorPhone
? Unable to create MIDlet GraphicsTestCanvas1???
? java.lang.InstantiationException:Class not a MIDlet??
? at com.sun.midp.midlet.MIDletState.createMIDlet(+51)
? at com.sun.midp.midlet.Selector.run(+22)
?

------解决方法--------------------
Class not a MIDlet
? 你首先要是个MIDlet啊
------解决方法--------------------
没有创建MIDlet类,而且我看起来连线程都没有。。。。。。。。
------解决方法--------------------
另外再建立一个class,应该是如下格式的:
?
? public class MyMIDlet extends MIDlet
? {
? protected void startApp()
? {
? }
? protected void pauseApp()
? {
? }
? protected void destroyApp(boolean unconditional)     

热点排行