java
Class.forName("javax.microedition.lcdui.Display");
java
new Command("Add", Command.SCREEN, 1)
java
new Command("Remove", Command.ITEM, 1)
java
new Command("Exit", Command.EXIT, 1)
java
new Command("Message", Command.ITEM, 1)
java
super("Instant Messenger", Choice.IMPLICIT);
addCommand(addContactBtn);
addCommand(contactActionBtn);
addCommand(removeContactBtn);
addCommand(exitBtn);
setCommandListener(new CommandListener() {
public void commandAction(Command c, Displayable d) {
if (c.equals(addContactBtn)) {
notifyAddClicked();
} else if (c.equals(removeContactBtn)) {
notifyRemoveClicked();
} else if (c.equals(contactActionBtn)) {
notifyContactAction();
} else {
im.InstantMessagingClient.getInstance().notifyDestroyed();
}
}
});
im.InstantMessagingClient client = im.InstantMessagingClient
.getInstance();
Display.getDisplay(client).setCurrent(this);
java
insert(index, c.toString(), getStatusIcon(c.getStatus()));
java
delete(index);
java
return getSelectedIndex();
java
for (java.util.Enumeration ls = getListeners(); ls.hasMoreElements();) {
((ContactListViewListener) ls.nextElement()).onContactListAdd();
}
java
for (java.util.Enumeration ls = getListeners(); ls.hasMoreElements();) {
((ContactListViewListener) ls.nextElement()).onContactListRemove();
}
java
for (java.util.Enumeration ls = getListeners(); ls.hasMoreElements();) {
((ContactListViewListener) ls.nextElement()).onContactListAction();
}
java
if (enabled) {
im.InstantMessagingClient client = im.InstantMessagingClient
.getInstance();
Display.getDisplay(client).setCurrent(this);
}
java
final Image iconURL;
final im.InstantMessagingClient imc = im.InstantMessagingClient
.getInstance();
try {
if (status != null) {
if (status.equals("away")) {
iconURL = Image.createImage("/im/view/lcdui/away.png");
} else if (status.equals("dnd")) {
iconURL = Image.createImage("/im/view/lcdui/busy.png");
} else if (status.equals("xa")) {
iconURL = Image
.createImage("/im/view/lcdui/extended-away.png");
} else if (status.equals("offline")) {
iconURL = Image.createImage("/im/view/lcdui/offline.png");
} else {
iconURL = Image.createImage("/im/view/lcdui/available.png");
}
} else {
iconURL = Image.createImage("/im/view/lcdui/offline.png");
}
return iconURL;
} catch (Exception e) {
imc.report(e);
}
return null;
java
new TextField("", "", 256, TextField.ANY)
java
new Command("Send", Command.SCREEN, 1)
java
new Command("Close", Command.BACK, 1)
java
super("Message");
append(messageField);
addCommand(sendBtn);
addCommand(closeBtn);
setCommandListener(new CommandListener() {
public void commandAction(Command c, Displayable d) {
if (c.equals(sendBtn)) {
notifySendClicked();
} else {
notifyClose();
}
}
});
im.InstantMessagingClient client = im.InstantMessagingClient
.getInstance();
previousScreen = Display.getDisplay(client).getCurrent();
Display.getDisplay(client).setCurrent(this);
java
return messageField.getString();
java
if (c instanceof String) {
append(c.toString() + "\n");
} else if (c instanceof Image) {
Image im = (Image) c;
append(im);
}
java
for (java.util.Enumeration ls = getListeners(); ls.hasMoreElements();) {
((ConversationViewListener) ls.nextElement()).onConversationClose();
}
im.InstantMessagingClient client = im.InstantMessagingClient
.getInstance();
Display.getDisplay(client).setCurrent(previousScreen);
java
for (java.util.Enumeration ls = getListeners(); ls.hasMoreElements();) {
((ConversationViewListener) ls.nextElement()).onConversationSend();
}
messageField.setString("");
java
im.InstantMessagingClient client = im.InstantMessagingClient
.getInstance();
Display.getDisplay(client).setCurrent(this);
java
new Command("OK", Command.OK, 1)
java
new Command("Cancel", Command.CANCEL, 1)
java
new TextField("User ID", "", 64, TextField.ANY)
java
new TextField("Name", "", 64, TextField.ANY)
java
new ChoiceGroup("Network", Choice.EXCLUSIVE)
java
new TextField("Password", "", 64, TextField.PASSWORD)
java
super("Add new contact");
append(networkField);
append(uidField);
append(nameField);
append(passwordField);
addCommand(okBtn);
addCommand(cancelBtn);
setCommandListener(new CommandListener() {
public void commandAction(Command c, Displayable d) {
if (c.equals(okBtn)) {
onOk();
} else {
onCancel();
}
}
});
im.InstantMessagingClient client = im.InstantMessagingClient
.getInstance();
Display.getDisplay(client).setCurrent(this);
java
return uidField.getString();
java
return nameField.getString();
java
return networkField.getSelectedIndex();
java
return passwordField.getString();
java
networkField.append(n, null);
java
notifyListeners(true);
java
notifyListeners(false);
java
for (java.util.Enumeration ls = getListeners(); ls.hasMoreElements();) {
((NewContactDialogListener) ls.nextElement())
.onNewContactDialogClose(okClicked, this);
}