📄 dictionarymenu.java
字号:
/**
* @(#)DictionaryMenu.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.dictionary;
import com.j2me.language.*;
import com.j2me.main.*;
import javax.microedition.lcdui.*;
/**
*类DictionaryMenu是用来描述在线词典功能菜单界面。
*/
public class DictionaryMenu extends List implements CommandListener
{
private Display display = null;
private MainList mainList = null;
/*用英语搜索类*/
private SearchEnglishForm s_E_F;
/*用中文搜索*/
private SearchChineseForm s_C_F;
private Command backCommand = null;
private Command okCommand = null;
private Command playCommand = null;
public Image[] icon = { createImage("/icon/phone.png"),createImage("/icon/football.png")};
/*
*初始话功能菜单
*/
public DictionaryMenu()
{
super("在线词典", List.IMPLICIT); //继承超类,并设置属性为当选择是当前操作的项目在命令初始化时被选中
append("按英文查找", icon[0]);
append("按中文查找", 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, MainList mainList) //用来显示界面
{
this.display = display;
this.mainList = mainList;
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(mainList);
}
if (c == okCommand)
{
int listIndex;
listIndex = this.getSelectedIndex(); //得到你所选择的是哪个菜单并作出响应, 你按下的是电话薄
if (listIndex == 0)
{
if (Language.isEnglish)
{
s_E_F = new SearchEnglishForm(this.getString(listIndex));
s_E_F.key.setLabel("Key");
s_E_F.result.setLabel("Result");
s_E_F.choice.setLabel("Filter");
s_E_F.choice.set(0, "Exactness Find", null);
s_E_F.choice.set(1, "Mistiness Find", null);
s_E_F.showForm(display, this);
}
else
{
s_E_F = new SearchEnglishForm(this.getString(listIndex));
s_E_F.key.setLabel("关键字");
s_E_F.result.setLabel("结果");
s_E_F.choice.setLabel("过滤");
s_E_F.choice.set(0, "精确查找", null);
s_E_F.choice.set(1, "模糊查找", null);
s_E_F.showForm(display, this);
}
}
if (listIndex == 1)
{
if (Language.isEnglish)
{
s_C_F = new SearchChineseForm(this.getString(listIndex));
s_C_F.key.setLabel("Key");
s_C_F.result.setLabel("Info");
s_C_F.choice.setLabel("Result");
s_C_F.showForm(display, this);
}
else
{
s_C_F = new SearchChineseForm(this.getString(listIndex));
s_C_F.key.setLabel("关键字");
s_C_F.result.setLabel("详细信息");
s_C_F.choice.setLabel("结果");
s_C_F.showForm(display, this);
}
}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -