📄 menu.java
字号:
import javax.microedition.lcdui.Graphics;
import javax.microedition.lcdui.Image;
public class Menu {
Image img[];
int index = 0;
public Menu(Image img[]) {
this.img = img;
}
void paint(Graphics g) {
g.drawImage(img[0], 0, 0, 0);
g.drawImage(img[3], 100, 134, 0);
g.setClip(99 + index * 13, 127, 15, 66);
g.drawImage(img[2], 100, 134, 0);
for (int i = 0; i < 4; i++) {
g.drawImage(img[1], 99 + index * 13, 127, 0);
}
}
public void keypr(int key) {
switch (key) {
case Tools.LEFT_KEY:
case Tools.FOUR_KEY:
index--;
if (index < 0) {
index = 3;
}
break;
case Tools.RIGHT_KEY:
case Tools.SIX_KEY:
index++;
if (index > 3) {
index = 0;
}
break;
case Tools.FIRE_KEY:
case Tools.FIVE_KEY:
switch (index) {
case 0:
MyCanvas.games = Tools.GAME_LOAD;
break;
case 1:
break;
case 2:
break;
case 3:
MyCanvas.games = Tools.GAME_EXIT;
break;
}
break;
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -