J2me制作会动的波浪字体方法及代码

J2me制作会动的波浪字体方法及代码,第1张

J2me制作会动的波浪字体方法及代码,第2张

导入javax . micro edition . lcdui . *;
导入javax . micro edition . midlet . *;
公共类DrawCanvas扩展MIDlet实现Command listener {
私有命令exitCommand
private hcan vas SG;
public draw canvas(){
Exit Command = new Command(" Exit ",命令。退出,1);
SG = new hcan vas();
SG . add command(exit command);
SG . set command listener(this);
Display.getDisplay(this)。set current(SG);

}
protected void startApp(){
}
protected void pause app(){
}
protected void destroyApp(boolean arg 0){
}
public void Command action(Command c,displayabled){
if(c = = exit Command){
destroyApp(false);
notify destroyed();
}
}
}
hcan vas类扩展Canvas实现Runnable{

私有字符串str =新字符串(" PRESS 5 ");
private int[] ak={0,0,0,0,0,0,1,2,3,3,2,1,0,0,0,0,0,0,0 };
布尔石开= true
private int k = 6;

public hcan vas(){
new Thread(this)。start();
}

受保护的void paint(Graphics g){
g . set color(0x 00 ffffff);
g.fillRect(0,0,getWidth(),getHeight());
g . set color(0x 00000000);
for(int I = 0;I < str . length();i++){
g . drawstring(str . substring(I,i+1),20+i*7,10-ak[k-i],0);
g . drawstring(str . substring(I,i+1),21+i*7,11-ak[k-i],0);//加权字体7为字体宽度
}
}
public void run(){
while(石开){
try {
repaint();//重新描述
thread . sleep(70);//等待一定时间
k++;
if(k >(AK . length-1))k = 6;
}
catch(interrupted exception e){ }
}
}
}

位律师回复
DABAN RP主题是一个优秀的主题,极致后台体验,无插件,集成会员系统
白度搜_经验知识百科全书 » J2me制作会动的波浪字体方法及代码

0条评论

发表评论

提供最优质的资源集合

立即查看 了解详情