Guest User

Untitled

a guest
Apr 11th, 2016
25
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 3.15 KB | None | 0 0
  1. import java.util.Timer;
  2. import javax.microedition.lcdui.ChoiceGroup;
  3. import javax.microedition.lcdui.Command;
  4. import javax.microedition.lcdui.CommandListener;
  5. import javax.microedition.lcdui.Display;
  6. import javax.microedition.lcdui.Displayable;
  7. import javax.microedition.lcdui.Form;
  8. import javax.microedition.lcdui.StringItem;
  9. import javax.microedition.lcdui.TextField;
  10. import javax.microedition.midlet.MIDlet;
  11.  
  12. public class pinger extends MIDlet implements CommandListener
  13. {
  14.     Display display;
  15.     Form form;
  16.     TextField host;
  17.     TextField user;
  18.     TextField pass;
  19.     TextField admin;
  20.     TextField interval;
  21.     Command ok_Command;
  22.     Command exit;
  23.     Command stop;
  24.     Timer timer;
  25.     int vInterval;
  26.     ChoiceGroup options;
  27.     StringItem str;
  28.  
  29.     public void flash()
  30.     {
  31.         int int_1 = 0;
  32.         for (; int_1 < 4; int_1++)
  33.         {
  34.             display.flashBacklight(250);
  35.         }
  36.     }
  37.    
  38.     public void mainScreen()
  39.     {
  40.         form.deleteAll();
  41.         form.removeCommand(stop);
  42.         form.append(host);
  43.         form.append(user);
  44.         form.append(pass);
  45.         form.append(admin);
  46.         form.append(interval);
  47.         form.append(options);
  48.         form.addCommand(exit);
  49.         form.addCommand(ok_Command);
  50.         form.setCommandListener(this);
  51.         display.setCurrent(form);
  52.     }
  53.    
  54.     public void ping()
  55.     {
  56.         form.deleteAll();
  57.         form.append(str);
  58.         form.removeCommand(ok_Command);
  59.         form.addCommand(stop);
  60.         timer = new Timer();
  61.         pinger.task pinger$task_1 = new task();
  62.         timer.schedule(pinger$task_1, (long) 0, (long) (1000 * Integer.parseInt(interval.getString())));
  63.     }
  64.    
  65.     public void startApp()
  66.     {
  67.         display = Display.getDisplay(this);
  68.         mainScreen();
  69.     }
  70.    
  71.     public void pauseApp()
  72.     {
  73.     }
  74.    
  75.     public void destroyApp(boolean boolean_1)
  76.     {
  77.         notifyDestroyed();
  78.     }
  79.    
  80.     public void commandAction(Command command_1, Displayable displayable_1)
  81.     {
  82.         String string_1 = command_1.getLabel();
  83.         if (string_1.equals("Exit"))
  84.         {
  85.             destroyApp(true);
  86.         }
  87.         else if (string_1.equals("Stop"))
  88.         {
  89.             timer.cancel();
  90.             mainScreen();
  91.         }
  92.         else if (string_1.equals("Ok"))
  93.         {
  94.             ping();
  95.         }
  96.     }
  97.    
  98.     public pinger()
  99.     {
  100.         form = new Form("Reloader");
  101.         str = new StringItem("", "");
  102.         vInterval = 40;
  103.         options = new ChoiceGroup("Options", 2);
  104.         options.append("Flash on alive", null);
  105.         options.append("Vibrate on alive", null);
  106.         host = new TextField("Server", "http://xxx.freevar.com/index.php", 150, 4);
  107.         user = new TextField("User", "botname", 35, 4);
  108.         pass = new TextField("Pass", "", 36, 4);
  109.         admin = new TextField("Admin", "", 35, 4);
  110.         interval = new TextField("Interval", "40", 5, 2);
  111.         ok_Command = new Command("Ok", 4, 1);
  112.         exit = new Command("Exit", 7, 3);
  113.         stop = new Command("Stop", 4, 2);
  114.     }
  115.    
  116. // Warning! Inner class pinger$task not found!
  117.  
  118. }
Add Comment
Please, Sign In to add comment