Guest User

Untitled

a guest
Jun 24th, 2018
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.93 KB | None | 0 0
  1. /*
  2.  * To change this template, choose Tools | Templates
  3.  * and open the template in the editor.
  4.  */
  5.  
  6.  
  7. import javax.microedition.lcdui.Alert;
  8. import javax.microedition.lcdui.AlertType;
  9. import javax.microedition.lcdui.Command;
  10. import javax.microedition.lcdui.CommandListener;
  11. import javax.microedition.lcdui.Display;
  12. import javax.microedition.lcdui.Displayable;
  13. import javax.microedition.lcdui.Form;
  14. import javax.microedition.lcdui.StringItem;
  15. import javax.microedition.midlet.*;
  16.  
  17. /**
  18.  * @author Łukasz
  19.  */
  20. public class hello_midlet extends MIDlet implements CommandListener {
  21.  
  22.     private Form myForm;
  23.     private Display myDisplay;
  24.     private StringItem myString;
  25.     private Command myExit;
  26.     private Command Vypis;
  27.     private Alert myAlert;
  28.    
  29.     public void initialize()
  30.     {
  31.         myForm = new Form("Ahoj");
  32.         myString = new StringItem("Ahoj svete", "vitej u nas");
  33.         myExit = new Command("Konec", Command.EXIT, 0);
  34.         Vypis = new Command("Vypis", Command.OK, 0);
  35.         myAlert = new Alert("Tea Time");
  36.     }
  37.    
  38.    
  39.     public void startApp() {
  40.        
  41.         initialize();
  42.         myDisplay = Display.getDisplay(this);
  43.         myDisplay.setCurrent(myForm);
  44.         myForm.append(myString);
  45.         myForm.append("Dnes je ctvrtek");
  46.         myForm.addCommand(myExit);
  47.         myForm.setCommandListener(this);
  48.         myForm.addCommand(Vypis);
  49.         myAlert.setTimeout(Alert.FOREVER);
  50.         myAlert.setType(AlertType.ALARM);
  51.         myAlert.setString("ERROR");
  52.        
  53.        
  54.     }
  55.    
  56.     public void pauseApp() {
  57.     }
  58.    
  59.     public void destroyApp(boolean unconditional) {
  60.     }
  61.  
  62.     public void commandAction(Command c, Displayable d) {
  63.         if( c == myExit)
  64.         {
  65.             notifyDestroyed();
  66.            // myForm.append("aaaaaa");
  67.         }
  68.        
  69.         else if( c == Vypis)
  70.         {
  71.             myForm.append("aaaaaaa");
  72.         }
  73.     }
  74. }
Add Comment
Please, Sign In to add comment