j2me这句代码请给下注释,谢谢
longstart_time=0;longtime=0;inta=1;//a代表什么?privatevoidshow_logo(Graphicsg){if(a>3){re...
long start_time = 0;
long time = 0;
int a = 1;//a代表什么?
private void show_logo(Graphics g) {
if (a > 3) {
return;
}
if (start_time == 0) {
start_time = System.currentTimeMillis();
}
time = System.currentTimeMillis() - start_time;
if (time > 1500) {
a++;
start_time = 0;
}
//int key;
switch (a) {
case 1: {
Image b_img = this.loadimg("/logo_176.png");
g.setColor(0, 0, 0); //change color into black
g.fillRect(0, 0, this.Screen_width, this.Screen_height);
g.drawImage(b_img, (this.Screen_width - b_img.getWidth()) / 2,
(this.Screen_height - b_img.getHeight()) / 2,0);//Graphics.LEFT | Graphics.TOP
//绘制提示字体
g.setFont(Font.getFont(Font.FACE_SYSTEM, Font.STYLE_BOLD,
Font.SIZE_MEDIUM));
g.setColor(255, 255, 0);
g.drawString("1945", this.Screen_width / 2, this.Screen_height,
Graphics.BOTTOM | Graphics.HCENTER);
}
break;
default:
break;
}
} 展开
long time = 0;
int a = 1;//a代表什么?
private void show_logo(Graphics g) {
if (a > 3) {
return;
}
if (start_time == 0) {
start_time = System.currentTimeMillis();
}
time = System.currentTimeMillis() - start_time;
if (time > 1500) {
a++;
start_time = 0;
}
//int key;
switch (a) {
case 1: {
Image b_img = this.loadimg("/logo_176.png");
g.setColor(0, 0, 0); //change color into black
g.fillRect(0, 0, this.Screen_width, this.Screen_height);
g.drawImage(b_img, (this.Screen_width - b_img.getWidth()) / 2,
(this.Screen_height - b_img.getHeight()) / 2,0);//Graphics.LEFT | Graphics.TOP
//绘制提示字体
g.setFont(Font.getFont(Font.FACE_SYSTEM, Font.STYLE_BOLD,
Font.SIZE_MEDIUM));
g.setColor(255, 255, 0);
g.drawString("1945", this.Screen_width / 2, this.Screen_height,
Graphics.BOTTOM | Graphics.HCENTER);
}
break;
default:
break;
}
} 展开
3个回答
展开全部
//计时器起始时间
long start_time = 0;
//当前时间与计时器起始时间的差值
long time = 0;
//计时次数
//在这里可以用在更换LOGO上,即每1.5秒替换一张图片
//换个地方使用,图片用3、2、1数字的话,可看作是倒计时
int a = 1;
//绘制LOGO
private void show_logo(Graphics g) {
/*************************************/
//下面这段不是应该放在run里面的吗?
//3*1.5秒后,绘制结束
if (a > 3) {
return;
}
//如果起始时间为0,则将起始时间赋值为当前时间
if (start_time == 0) {
start_time = System.currentTimeMillis();
}
//计算当前时间与计时器起始时间的差值
time = System.currentTimeMillis() - start_time;
//如果大于1.5秒
if (time > 1500) {
//累计次数加1
a++;
//将计时器起始时间清0
start_time = 0;
}
/*************************************/
// int key;
switch (a) {
//绘制第一张LOGO
case 1: {
Image b_img = this.loadimg("/logo_176.png");
g.setColor(0, 0, 0); // change color into black
g.fillRect(0, 0, this.Screen_width, this.Screen_height);
g.drawImage(b_img, (this.Screen_width - b_img.getWidth()) / 2,
(this.Screen_height - b_img.getHeight()) / 2, 0);// Graphics.LEFT
// |
// Graphics.TOP
// 绘制提示字体
g.setFont(Font.getFont(Font.FACE_SYSTEM, Font.STYLE_BOLD,
Font.SIZE_MEDIUM));
g.setColor(255, 255, 0);
g.drawString("1945", this.Screen_width / 2, this.Screen_height,
Graphics.BOTTOM | Graphics.HCENTER);
}
break;
default:
break;
}
}
long start_time = 0;
//当前时间与计时器起始时间的差值
long time = 0;
//计时次数
//在这里可以用在更换LOGO上,即每1.5秒替换一张图片
//换个地方使用,图片用3、2、1数字的话,可看作是倒计时
int a = 1;
//绘制LOGO
private void show_logo(Graphics g) {
/*************************************/
//下面这段不是应该放在run里面的吗?
//3*1.5秒后,绘制结束
if (a > 3) {
return;
}
//如果起始时间为0,则将起始时间赋值为当前时间
if (start_time == 0) {
start_time = System.currentTimeMillis();
}
//计算当前时间与计时器起始时间的差值
time = System.currentTimeMillis() - start_time;
//如果大于1.5秒
if (time > 1500) {
//累计次数加1
a++;
//将计时器起始时间清0
start_time = 0;
}
/*************************************/
// int key;
switch (a) {
//绘制第一张LOGO
case 1: {
Image b_img = this.loadimg("/logo_176.png");
g.setColor(0, 0, 0); // change color into black
g.fillRect(0, 0, this.Screen_width, this.Screen_height);
g.drawImage(b_img, (this.Screen_width - b_img.getWidth()) / 2,
(this.Screen_height - b_img.getHeight()) / 2, 0);// Graphics.LEFT
// |
// Graphics.TOP
// 绘制提示字体
g.setFont(Font.getFont(Font.FACE_SYSTEM, Font.STYLE_BOLD,
Font.SIZE_MEDIUM));
g.setColor(255, 255, 0);
g.drawString("1945", this.Screen_width / 2, this.Screen_height,
Graphics.BOTTOM | Graphics.HCENTER);
}
break;
default:
break;
}
}
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询