Guest User

Untitled

a guest
Dec 16th, 2019
79
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. package lab7;
  2.  
  3. import java.util.Timer;
  4. import java.util.TimerTask;
  5. import javax.microedition.lcdui.Display;
  6. import javax.microedition.midlet.*;
  7.  
  8. public class Midlet extends MIDlet {
  9.  
  10. Display ekran;
  11. PadajacySnieg zamiec = new PadajacySnieg();
  12. Grawitacja padaSnieg = new Grawitacja();
  13. Timer timer = new Timer();
  14.  
  15. public Midlet() {
  16. ekran = Display.getDisplay(this);
  17. }
  18.  
  19. protected void destroyApp(boolean unconditional) {}
  20.  
  21. protected void startApp() {
  22. ekran.setCurrent(zamiec);
  23. timer.schedule(padaSnieg, 10, 10);
  24. }
  25.  
  26. protected void pauseApp() {}
  27.  
  28. public void exit() {
  29. timer.cancel();
  30.  
  31. destroyApp(true);
  32. notifyDestroyed();
  33. }
  34.  
  35. class Grawitacja extends TimerTask {
  36. public void run() {
  37. zamiec.scroll();
  38. }
  39. }
  40. }
RAW Paste Data