📄 deletescreen.java
字号:
import javax.microedition.lcdui.*;
import java.io.IOException;
public class DeleteScreen extends Form implements CommandListener
{
private Command deleteCommand, backCommand;
private ChoiceGroup recStore;
private String[] table;
private int selection;
public DeleteScreen()
{
super("Delete Screen");
try
{
deleteCommand = new Command("Delete", Command.OK, 0);
backCommand = (new Command("Back", Command.BACK, 1));
addCommand(deleteCommand);
addCommand(backCommand);
setCommandListener(this);
table = TelephoneListMIDlet.pd.readRecordStore();
recStore = new ChoiceGroup("", ChoiceGroup.EXCLUSIVE, table, null);
append("select the record you want to delete by using the up an down arrows and then pressing SELECT");
append("press the delete button to delete the record");
append(recStore);
}
catch (Exception e)
{
e.printStackTrace();
}
}
public void commandAction(Command c, Displayable d)
{
if (c == deleteCommand)
{
selection = recStore.getSelectedIndex();
String recordno = TelephoneListMIDlet.pd.getRecno(table[selection]);
TelephoneListMIDlet.pd.deleteRecord(Integer.parseInt(recordno));
}
else if (c == backCommand)
{
Display.getDisplay(TelephoneListMIDlet.instance).setCurrent(
TelephoneListMIDlet.instance.getForm());
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -