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

WAP之家技术文章J2ME技术程序开发基于Nokia S40的猜数字游戏之一

基于Nokia S40的猜数字游戏之一
作者:mingjava  来源:J2MEDV  发布时间:2005-9-7 12:04:58
void setCount(int count)
{
this.count = count;
}

public void reset()
{
setCount(0);
this.first = true;
}

public void setAB(int[] ab)
{
this.ab[count][0] = ab[0];
this.ab[count][1] = ab[1];
}

public void setInput(int[] input)
{
for(int i = 0;i<input.length;i++)
{
this.input[count][i] = input[i];
}
}

public void setOpen(boolean open)
{
this.open = open;
}

public int getLineHeight()
{
return this.getFont().getHeight();
}

private String getInput(int count)
{
return ""+input[count][0]+input[count][1]+input[count][2]+input[count][3];
}

protected void paintArea(Graphics g, boolean hasFocus)
{
if (first)
{
first = false;

return;
}
if (open)
{
count++;

if (count <= 5)
{
for (int i = 0; i < count; i++)
{
g.drawString(i + 1 + ":" + ab[i][0] + "A" + ab[i][1] + "B "+getInput(i),
px, py + i * getLineHeight(), Graphics.TOP
| Graphics.LEFT);

}
} else
{
for (int i = 0; i < 5; i++)
{
g.drawString(i + 1 + ":" + ab[i][0] + "A" + ab[i][1] + "B "+getInput(i),
px, py + i * getLineHeight(), Graphics.TOP
| Graphics.LEFT);

}
for (int j = 5; j < count; j++)
{
g.drawString(j + 1 + ":" + ab[j][0] + "A" + ab[j][1] + "B "+getInput(j),
px + this.getWidth()/2+1, py + (j - 5)
* getLineHeight(), Graphics.TOP
| Graphics.LEFT);
}
}

}
}
}

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

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

用户名: 查看更多评论

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

内 容:

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