WAP之家:为您提供最全最新的WAP技术,CP.SP.3G等行业资讯。 WAP之家交流论坛全新开放 点击进入>>
WAP资讯 | 3G动态 | SP动态 | 运营商动态 | 内容商动态 | 制造商动态 | 论坛讨论>> 每次自动访问
WAP技术 | WAP源码 | 手机编程 | 手机源码 | 无线技术 | J2ME技术 | 手机软件 添加到收藏夹
IVR技术 | SP资料 | SMS MMS技术 | 商业方案 | IVR下载 | 书籍教程 | 工具软件 语言:繁體中文

WAP之家技术文章J2ME技术程序开发用J2ME在移动设备上实现动画

用J2ME在移动设备上实现动画
作者:佚名  来源:转载  发布时间:2005-8-10 11:30:55
b;
b.move( genRandom( w ), genRandom( h ) );
c.add( b );
timer.schedule( b, genRandom( 1000 ),
genRandom( 400 ) );
};

c.addCommand( exitCommand );
c.setCommandListener( this );

getDisplay().setCurrent( c );
};
catch( IOException e ){;
System.out.println( "Could not
load images" );
exitMIDlet();
};
};

// Load the bird animation, which is stored as a
// series of PNG files in the MIDlet suite.

private Image[] loadFrames( String name, int frames )
throws IOException {;
Image[] images = new Image[frames];
for( int i = 0; i < frames; ++i ){;
images = Image.createImage( name +
i + ".png" );
};

return images;
};

protected void pauseApp(){;
};

protected void startApp()
throws MIDletStateChangeException {;
if( display == null ){;
display = Display.getDisplay( this );
initMIDlet();
};
};
};

七帧图片的动画,你可以看到一个拍着翅膀的小鸟。MIDlet显示了5只小鸟,小鸟的位置和刷新速度是随机的。
你可以用一些其他的办法来改进这个程序,但这个程序也应该足够能让你上手了。

上一页  [1] [2] [3] 

[] [返回上一页] [打 印]
文章评论

用户名: 查看更多评论

分 值:100分 85分 70分 55分 40分 25分 10分 0分

内 容:

         (注“”为必填内容。) 验证码: 验证码,看不清楚?请点击刷新验证码