Display Alert


<strong>//jad file (please verify the jar size)</strong>
<strong>/*</strong>
<strong>MIDlet-Name: DisplayAlert</strong>
<strong>MIDlet-Version: 1.0</strong>
<strong>MIDlet-Vendor: MyCompany</strong>
<strong>MIDlet-Jar-URL: DisplayAlert.jar</strong>
<strong>MIDlet-1: DisplayAlert, , DisplayAlert</strong>
<strong>MicroEdition-Configuration: CLDC-1.0</strong>
<strong>MicroEdition-Profile: MIDP-1.0</strong>
<strong>MIDlet-JAR-SIZE: 100</strong>

<strong>*/</strong>
<strong>import javax.microedition.lcdui.Alert;</strong>
<strong>import javax.microedition.lcdui.AlertType;</strong>
<strong>import javax.microedition.lcdui.Command;</strong>
<strong>import javax.microedition.lcdui.CommandListener;</strong>
<strong>import javax.microedition.lcdui.Display;</strong>
<strong>import javax.microedition.lcdui.Displayable;</strong>
<strong>import javax.microedition.lcdui.Form;</strong>
<strong>import javax.microedition.midlet.MIDlet;</strong>
<strong>import javax.microedition.midlet.MIDletStateChangeException;</strong>

<strong>public class DisplayAlert extends MIDlet implements CommandListener {</strong>
<strong> private Display display;</strong>

<strong>private Alert alert;</strong>

<strong>private Form form = new Form(”Throw Exception”);</strong>

<strong>private Command exit = new Command(”Exit”, Command.SCREEN, 1);</strong>

<strong>private boolean exitFlag = false;</strong>

<strong>public DisplayAlert() {</strong>
<strong> display = Display.getDisplay(this);</strong>
<strong> form.addCommand(exit);</strong>
<strong> form.setCommandListener(this);</strong>
<strong> }</strong>

<strong>public void startApp() {</strong>
<strong> display.setCurrent(form);</strong>
<strong> }</strong>

<strong>public void pauseApp() {</strong>
<strong> }</strong>

<strong>public void destroyApp(boolean unconditional) throws MIDletStateChangeException {</strong>
<strong> if (unconditional == false) {</strong>
<strong> throw new MIDletStateChangeException();</strong>
<strong> }</strong>
<strong> }</strong>

<strong>public void commandAction(Command command, Displayable displayable) {</strong>
<strong> if (command == exit) {</strong>
<strong> try {</strong>
<strong> if (exitFlag == false) {</strong>
<strong> alert = new Alert(”Busy”, “Please try again.”, null, AlertType.WARNING);</strong>
<strong> alert.setTimeout(Alert.FOREVER);</strong>
<strong> display.setCurrent(alert, form);</strong>
<strong> destroyApp(false);</strong>
<strong> } else {</strong>
<strong> destroyApp(true);</strong>
<strong> notifyDestroyed();</strong>
<strong> }</strong>
<strong> } catch (Exception exception) {</strong>
<strong> exitFlag = true;</strong>
<strong> }</strong>
<strong> }</strong>
<strong> }</strong>
<strong>}</strong>

Tinggalkan Balasan

Isikan data di bawah atau klik salah satu ikon untuk log in:

Logo WordPress.com

You are commenting using your WordPress.com account. Logout / Ubah )

Gambar Twitter

You are commenting using your Twitter account. Logout / Ubah )

Foto Facebook

You are commenting using your Facebook account. Logout / Ubah )

Foto Google+

You are commenting using your Google+ account. Logout / Ubah )

Connecting to %s

Zoemalang's community

ujung malang adalah Sebuah desa yang hilang terganti dengan ujung harapan

YoYo Games Blog Feed

Ujung malang adalah Sebuah desa yang hilang terganti dengan ujung harapan

Dealer Termurah

Menjual Segala Jenis Motor Baru Di Indonesia Cash Maupun Kredit

%d blogger menyukai ini: