NikitaGru

Untitled

Apr 23rd, 2021
13
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.53 KB | None | 0 0
  1. public class Level extends JWindow {
  2.  
  3. private final Timer timer = initTimer();
  4.  
  5. private static Timer initTimer()
  6. {
  7. Timer timer = new Timer("events generator", true);
  8. return timer;
  9. }
  10.  
  11. public Level() {
  12. setLayout(null);
  13. timer.schedule(new TimerTask()
  14. {
  15. @Override
  16. public void run()
  17. {
  18. onRedrawEvent();
  19. }
  20. }, 0, 10);
  21. }
  22.  
  23. protected void onRedrawEvent()
  24. {
  25. repaint();
  26. }
Advertisement
Add Comment
Please, Sign In to add comment