import javax.microedition.lcdui.Alert;
import javax.microedition.lcdui.Command;
import javax.microedition.lcdui.CommandListener;
import javax.microedition.lcdui.Displayable;
import javax.microedition.lcdui.TextField;
public class RFIDVerificationForm extends CustomForm {
private TextField txtRFIDNo = null;
private Command cmdVerify = null;
private Command cmdBack = null;
private static RFIDVerificationForm thisForm;
private static RFIDVerificationFormListener listener;
public RFIDVerificationForm() {
super();
thisForm = this;
initComponents();
addComponents();
}
protected void initComponents() {
txtRFIDNo = new TextField("Enter RFID No", "", 20, TextField.ANY);
cmdVerify = new Command("OK", Command.ITEM, 1);
cmdBack = new Command("Back", Command.BACK, 1);
}
protected void addComponents() {
append(txtRFIDNo);
addCommand(cmdVerify);
addCommand(cmdBack);
setCommandListener(getListener());
}
private RFIDVerificationFormListener getListener() {
if (listener == null) {
listener = new RFIDVerificationFormListener();
}
return listener;
}
public static RFIDVerificationForm getInstance() {
if (thisForm == null) {
thisForm = new RFIDVerificationForm();
}
thisForm.txtRFIDNo.setString("");
return thisForm;
}
private class RFIDVerificationFormListener implements CommandListener {
public void commandAction(Command cmd, Displayable displayable) {
if (cmd.getLabel().equals("Back")) {
thisForm.prevForm.setAsDisplay();
}
else if (cmd.getLabel().equals("OK")) {
}
}
}
}
No comments:
Post a Comment