📄 musicmenu.java
字号:
/**
* @(#)MusicMenu.java 1.11 01/08/23
* Copyright (c) 2004-2005 wuhua of workroom Inc. All Rights Reserved.
* @version 1.0, 10/05/2004
* @author 饶荣庆
* @author 余煜辉
*/
package com.j2me.recreation.music;
import com.j2me.recreation.*;
import com.j2me.language.*;
import com.j2me.main.*;
import javax.microedition.lcdui.*;
/**
*类MusicMenu是用来描述在线音乐功能菜单界面。
*/
public class MusicMenu extends List implements CommandListener
{
private Display display = null;
private RecreationMenu recreation = null;
private Command backCommand = null;
private Command okCommand = null;
public Image[] icon = { createImage("/icon/football.png"), createImage("/icon/phone.png")};
/*
*初始话功能菜单
*/
public MusicMenu()
{
super("动感娱乐", List.IMPLICIT); //继承超类,并设置属性为当选择是当前操作的项目在命令初始化时被选中
append("动感音乐", icon[0]);
append("动感MTV", icon[1]);
this.backCommand = new Command("返回", Command.BACK, 2);
this.okCommand = new Command("确定", Command.OK, 2);
this.addCommand(backCommand);
this.addCommand(okCommand);
this.setCommandListener(this);
}
/*显示菜单界面方法*/
public void showForm(Display display, RecreationMenu recreation) //用来显示界面
{
this.display = display;
this.recreation = recreation;
this.display.setCurrent(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)
{
if(c == backCommand)
{
this.display.setCurrent(recreation);
}
if (c == okCommand)
{
int listIndex;
listIndex = this.getSelectedIndex(); //得到你所选择的是哪个菜单并作出响应, 你按下的是电话薄
if (listIndex == 0)
{
if (Language.isEnglish)
{
}
else
{
}
}
if (listIndex == 1)
{
if (Language.isEnglish)
{
}
else
{
}
}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -