J2ME 简单的游戏选择界面
简单的游戏选择界面 使用Canvas // 计算整个菜单的高度,宽度和(x,y) int rectWidth = Width; int rectHeight = Height * b.length; int x = (getWidth() - rectWidth) / 2; int y = (getHeight() - rectHeight) / 2; // 画矩形 g.drawRect(x, y, rectWidth, rectHeight); for (int i = 1; i < b.length; i++) { g.drawLine(x, y + Height * i, x + rectWidth, y + Height * i); } // 画菜单选项,并根据selected的值判断焦点 for (int j = 0; j < b.length; j++) { if (selected == j) { g.setColor(0x6699cc); g.fillRect(x + 1, y + j * Height + 1, rectWidth - 1, Height - 1); g.setColor(color); } g.drawString(b[j], x + 8, y + j * Height + 4, Graphics.LEFT | Graphics.TOP); } Height - 1); g.setColor(color); } g.drawString(b[j], x + 8, y + j * Height + 4, Graphics.LEFT | Graphics.TOP); }
文件列表
Test.rar
(预估有个11文件)
Test
Test
.project
536B
bin
MineMidlet.class
1010B
MainCanvas.class
3KB
.settings
org.eclipse.jdt.core.prefs
208B
src
MineMidlet.java
1KB
暂无评论