MessageDialogpublic class MessageDialog extends Object Provides methods for simple messages and requests. |
Methods Summary |
---|
public static int | chooseItem(com.sun.midp.security.SecurityToken token, java.lang.String title, java.lang.String label, java.lang.String[] list)Displays dialog that allows user to select one element
from the list.
Dialog d = new Dialog(title, true);
ChoiceGroup choice =
new ChoiceGroup(label, Choice.EXCLUSIVE, list, null);
d.append(choice);
return d.waitForAnswer(token) == Dialog.CANCELLED ?
-1 : choice.getSelectedIndex();
| public static java.lang.String[] | enterNewPIN(com.sun.midp.security.SecurityToken token)Displays dialog with new PIN parameters.
Dialog d = new Dialog(
// "New PIN",
Resource.getString(
ResourceConstants.JSR177_PINDIALOG_TITLE_NEWPIN),
true);
TextField label = new TextField(
// "PIN label ",
Resource.getString(
ResourceConstants.JSR177_PINDIALOG_LABEL) + " ",
"", 32, 0);
TextField pin1 = new TextField(
// "Enter PIN ",
Resource.getString(
ResourceConstants.JSR177_PINDIALOG_ENTERPIN) + " ",
"", 8, TextField.PASSWORD | TextField.NUMERIC);
TextField pin2 = new TextField(
// "Confirm PIN ",
Resource.getString(
ResourceConstants.JSR177_PINDIALOG_CONFIRMPIN) + " ",
"", 8, TextField.PASSWORD | TextField.NUMERIC);
d.append(label);
d.append(pin1);
d.append(pin2);
while (true) {
if (d.waitForAnswer(token) == -1) {
return null;
}
String s = label.getString().trim();
if (s.equals("")) {
continue;
}
String h1 = pin1.getString().trim();
String h2 = pin2.getString().trim();
if (h1.equals("") ||
! h1.equals(h2) ||
h1.length() < 4) {
pin1.setString("");
pin2.setString("");
continue;
}
return new String[] {s, h1};
}
| public static int | showMessage(com.sun.midp.security.SecurityToken token, java.lang.String title, java.lang.String message, boolean withCancel)Displays dialog with informational message or confirmation
request.
Dialog d = new Dialog(title, withCancel);
d.append(new StringItem(message, null));
return d.waitForAnswer(token);
|
|