📄 searchphoneui.java
字号:
/*
* Created on 2004-6-25
*
* TODO To change the template for this generated file go to
* Window - Preferences - Java - Code Style - Code Templates
*/
package com.north.phonebook.ui;
import javax.microedition.lcdui.*;
/**
* @author P2800
*
* TODO To change the template for this generated type comment go to Window -
* Preferences - Java - Code Style - Code Templates
*/
public class SearchPhoneUI extends Form implements CommandListener,ItemStateListener
{
private UIController uicontroller;
private TextField inputField;
public static final Command backCommand = new Command("返回",Command.BACK,2);
public static final Command searchCommand = new Command("搜索",Command.OK,1);
public SearchPhoneUI(UIController uicontroller)
{
super(Title.search);
this.uicontroller = uicontroller;
inputField = new TextField(Title.name, null, 20,
TextField.ANY);
this.append(inputField);
this.addCommand(backCommand);
this.addCommand(searchCommand);
this.setCommandListener(this);
this.setItemStateListener(this);
}
public void init()
{
inputField.setString("");
}
/*
* (non-Javadoc)
*
* @see javax.microedition.lcdui.CommandListener#commandAction(javax.microedition.lcdui.Command,
* javax.microedition.lcdui.Displayable)
*/
public void commandAction(Command arg0, Displayable arg1)
{
// TODO Auto-generated method stub
if(arg0 == backCommand)
{
uicontroller.handleEvent(UIController.EventID.EVENT_SEARCHUI_BACK_MAINNUI);
}
else if(arg0 == searchCommand)
{
String userName = inputField.getString();
if(userName.length()!= 0)
{
uicontroller.handleEvent(UIController.EventID.EVENT_SEARCH_RECORD_ANYWAY,new Object[]{userName});
}
}
}
public void itemStateChanged(Item item)
{
if(item == inputField)
{
String userName = inputField.getString();
if(userName.length()!= 0)
{
uicontroller.handleEvent(UIController.EventID.EVENT_SEARCH_RECORD,new Object[]{userName});
}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -