※リストが表示されない場合
AddBlockなどの広告ブロックツールがONになっているとリストなどが表示されない場合があります。これらのツールをOFFにしてみてください。
※MainCanvasの修正
class MainCanvas extends Canvas {
private Image image;
private static final int MAX_X = 5,MAX_Y = 5;
private static final int IMG_W = 32,IMG_H = 32;
private int x, y;
private boolean[][] flg;
MainCanvas() {
this.setSoftLabel(Frame.SOFT_KEY_2, "EXIT");
flg = new boolean[MAX_X][MAX_Y];
try {
MediaImage mi = MediaManager.getImage("resource:///image.gif");
mi.use();
image = mi.getImage();
} catch (ConnectionException e) {
}
}
public void paint(Graphics g) {
g.lock();
g.clearRect(0, 0, this.getWidth(), this.getHeight());
for (int i = 0; i < MAX_X; i++) {
for (int j = 0; j < MAX_Y; j++) {
if (flg[i][j]) {
g.drawImage(image, i * IMG_W, j * IMG_H);
}
}
}
g.setColor(Graphics.getColorOfName(Graphics.RED));
g.drawRect(IMG_W * x, IMG_H * y, IMG_W, IMG_H);
g.unlock(true);
}
public void processEvent(int type, int param) {
super.processEvent(type, param);
switch (type) {
case Display.KEY_PRESSED_EVENT:
switch (param) {
case Display.KEY_UP:
y -= y == 0 ? 0 : 1;
break;
case Display.KEY_DOWN:
y += y == MAX_Y - 1 ? 0 : 1;
break;
case Display.KEY_LEFT:
x -= x == 0 ? 0 : 1;
break;
case Display.KEY_RIGHT:
x += x == MAX_X - 1 ? 0 : 1;
break;
case Display.KEY_SELECT:
flg[x][y] = !flg[x][y];
break;
case Display.KEY_SOFT2:
IApplication.getCurrentApp().terminate();
break;
}
repaint();
}
}
}
| << 前へ | 次へ >> |