/* * Copyright (C) 2011 www.itcsolutions.eu * * This file is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published * by the Free Software Foundation; either version 2.1, or (at your * option) any later version. * * This file is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * */ /** * * @author Catalin - www.itcsolutions.eu * @version june 2011 * */ package eu.itcsolutions.j2me; import javax.microedition.lcdui.Alert; import javax.microedition.lcdui.AlertType; import javax.microedition.lcdui.Display; import javax.microedition.lcdui.TextBox; import javax.microedition.lcdui.TextField; import javax.microedition.midlet.*; public class MidletUI extends MIDlet { //define the Display reference of the MIDlet Display midletDisplay = null; //define the TextBox reference TextBox textBox = null; //define the MIDlet constructor public MidletUI() { textBox = new TextBox( "Hello J2ME!", //the text from the form title bar "Your message is: ", //content 150, //maximum number of characters TextField.ANY); //filter on the content } public void startApp() { //get the reference for the Display instance if(midletDisplay==null) midletDisplay = Display.getDisplay(this); //display the form midletDisplay.setCurrent(textBox); //define an alert Alert alert = new Alert("Info", "The MIDlet has started !", null, AlertType.WARNING); alert.setTimeout(Alert.FOREVER); //display the alert and set the TextBox as the next displayable midletDisplay.setCurrent(alert, textBox); } public void pauseApp() { } public void destroyApp(boolean unconditional) { } }