?? mark.java
字號(hào):
package com.j2medev.numbergame;
import javax.microedition.lcdui.Font;
import javax.microedition.lcdui.Graphics;
public class Mark extends Area
{
private int px;
private int py;
private int count = 0;
private int[][] ab = new int[10][2];
private int[][] input = new int[10][4];
private boolean first = true;
private boolean open = false;
public Mark(int x, int y, int w, int h)
{
super(x, y, w, h);
px = x;
py = y;
}
public Mark(int x, int y, int w, int h, Font f)
{
super(x, y, w, h, f);
px = x;
py = y;
}
public int getCount()
{
return count;
}
public 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;
//g.drawString(getInput(0),10,40,Graphics.LEFT|Graphics.TOP);
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);
}
}
}
}
}
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -