This screen is used for displaying the encrypted message in hex presentation.
To create the class:
Assign the
class to the package satsa
and import the required classes.
package satsa; import javax.microedition.lcdui.Command; import javax.microedition.lcdui.CommandListener; import javax.microedition.lcdui.Displayable; import javax.microedition.lcdui.Form; import javax.microedition.lcdui.StringItem;
Create the
class by extending Form
and implementing CommandListener
.
// Screen used to display a decrypted message class EncryptScreen extends Form implements CommandListener { private final SATSAMIDlet midlet; private final Command commandBack = new Command("Back", Command.BACK, 1); private final Command commandShowDecrypted = new Command("Decrypt", Command.ITEM, 1); private int index; private String encryptedMessage; EncryptScreen(SATSAMIDlet midlet) { super(null); this.midlet = midlet; createForm(); } public void commandAction(Command c, Displayable d) { if (c==commandBack) { midlet.showMessageList(); } if (c==commandShowDecrypted) { midlet.showPasswordScreen(index); } } void setIndex(int index) { this.index = index; } void setMessage(String encryptedMessage) { this.encryptedMessage = encryptedMessage; createForm(); } private void createForm() { deleteAll(); setTitle("Encrypted Message "); StringItem messageItem = new StringItem(null, encryptedMessage); append(messageItem); addCommand(commandBack); addCommand(commandShowDecrypted); setCommandListener(this); } }