⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 gamemenu.java

📁 一个Java小程序
💻 JAVA
字号:
/**
 * @(#)GameMenu.java	
 * Copyright (c) 2004-2005 wuhua of workroom Inc. All Rights Reserved.
 * @version 	1.0, 10/05/2004
 * @author 	饶荣庆
 * @author 	
 */
package com.wuhua.mali;

import javax.microedition.lcdui.Command;
import javax.microedition.lcdui.CommandListener;
import javax.microedition.lcdui.Display;
import javax.microedition.lcdui.Displayable;
import javax.microedition.lcdui.Image;
import javax.microedition.lcdui.List;



/**
 *此类用来描述游戏功能界面菜单
 */
 
public class GameMenu extends List implements CommandListener
{
	private Display display = null;
 
	private Command okCommand = null;			//定义确定软键
	 
	public Image icon = createImage("/icon/21point.png");

	public GameMenu(String s)
	{
		super(s, List.IMPLICIT); 
		this.okCommand = new Command("确定", Command.OK, 2);
	 
		this.addCommand(okCommand);
		 

		this.append("21点游戏", icon);
		this.append("赛跑", icon);
		this.setCommandListener(this);
	}

	

	private Image createImage(String name)	 //定义创建菜单图片
	{
		Image aImage =null;
        try
		{ 
			aImage = Image.createImage(name);
		}
		catch(Exception e)
		{
			System.out.println("不能找到图标.");
		}
        return aImage;
     }

	public void commandAction(Command c,Displayable s)
	{
		 System.out.println("sdfsd");
		 
		if (c == okCommand)
		{
			int listIndex;
			listIndex = this.getSelectedIndex();	 //得到你所选择的是哪个菜单并作出响应
		 
			if (listIndex == 1)
			{
				
			}
		}

	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -