※リストが表示されない場合
AddBlockなどの広告ブロックツールがONになっているとリストなどが表示されない場合があります。これらのツールをOFFにしてみてください。
※MainCanvasの修正
// import java.util.*;
// import com.nttdocomo.util.*;
class MainCanvas extends Canvas implements TimerListener {
private Image image;
private int x, y, dx, dy, w, h;
private Random random;
private Timer timer;
private boolean flg;
MainCanvas() {
this.setSoftLabel(Frame.SOFT_KEY_1, "GO!");
this.setSoftLabel(Frame.SOFT_KEY_2, "EXIT");
random = new Random(new Date().getTime());
timer = new Timer();
timer.setTime(100);
timer.setRepeat(true);
timer.setListener(this);
try {
MediaImage mi = MediaManager.getImage("resource:///image.gif");
mi.use();
image = mi.getImage();
} catch (ConnectionException e) {}
w = Display.getWidth() - image.getWidth();
h = Display.getHeight() - image.getHeight();
}
public void paint(Graphics g) {
g.lock();
g.clearRect(0, 0, this.getWidth(), this.getHeight());
g.drawImage(image, x, y);
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_SOFT1:
if (!flg){
timer.start();
this.setSoftLabel(Frame.SOFT_KEY_1, "STOP");
flg = true;
} else {
timer.stop();
this.setSoftLabel(Frame.SOFT_KEY_1, "GO!");
flg = false;
}
break;
case Display.KEY_SOFT2:
IApplication.getCurrentApp().terminate();
break;
}
repaint();
}
}
public void timerExpired(Timer t) {
if (dx == 0){
dx = random.nextInt(11) - 5;
}
if (dy == 0){
dy = random.nextInt(11) - 5;
}
x += dx;
y += dy;
if (x < 0){
dx = 0;
x = 0;
}
if (x > w){
dx = 0;
x = w;
}
if (y < 0){
dy = 0;
y = 0;
}
if (y > h){
dy = 0;
y = h;
}
repaint();
}
}
| << 前へ | 次へ >> |