| 12
 3
 4
 5
 6
 7
 8
 9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 
 |  
package hello;
 
import javax.microedition.lcdui.Alert;
import javax.microedition.lcdui.AlertType;
import javax.microedition.lcdui.Command;
import javax.microedition.lcdui.CommandListener;
import javax.microedition.lcdui.Display;
import javax.microedition.lcdui.Displayable;
import javax.microedition.lcdui.Form;
import javax.microedition.lcdui.Image;
import javax.microedition.midlet.MIDlet;
import javax.microedition.midlet.MIDletStateChangeException;
 
/**
 *
 * @author amag8333
 */
public class trial extends MIDlet implements CommandListener {
 
Command exitCommand = new Command("Exit", Command.EXIT, 2);
 
boolean imageLoaded;
Image MyPicture;
Display display;
Alert alert;
static int DefaultTimeout=2000;
Form form1;
 
    public trial() {
 
            display = Display.getDisplay(this);
            form1 = new Form("test");
            form1.addCommand(exitCommand);
            form1.setCommandListener(this);
 
    }
 
    protected void startApp() throws MIDletStateChangeException {
       try {
            MyPicture = Image.createImage("/hello/IMAG0018.PNG");
            imageLoaded = true;
            } 
       catch (java.io.IOException ex) {
            System.err.println("Image is not loaded :" + imageLoaded);
        }         
 alert = new Alert("Raf et vivi" ,"", MyPicture,AlertType.INFO);
 alert.setTimeout(DefaultTimeout);
 
 
    }
 
    protected void pauseApp() {
        throw new UnsupportedOperationException("Not supported yet.");
    }
 
    protected void destroyApp(boolean arg0) throws MIDletStateChangeException {
        throw new UnsupportedOperationException("Not supported yet.");
    }
 
    public void commandAction(Command c, Displayable s) {
           try {
            if (c == exitCommand) {
                destroyApp(false);
                notifyDestroyed();
            }
        } catch (Exception ex) {
            ex.printStackTrace();
        }
    }
 
} | 
Partager