Advertisement
Guest User

Untitled

a guest
Jan 16th, 2018
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.77 KB | None | 0 0
  1. import javax.swing.*;
  2. import java.text.ParseException;
  3.  
  4. /**
  5. * Created by Asmonix on 2018-01-16.
  6. */
  7. public class StoperThread implements Runnable {
  8.  
  9. JLabel stoperLabel;
  10.  
  11.  
  12. public StoperThread(JLabel lab){
  13. this.stoperLabel=lab;
  14. Thread thread = new Thread();
  15. thread.start();
  16. }
  17.  
  18. @Override
  19. public void run() {
  20. int time;
  21. while(true){
  22.  
  23. System.out.println("StoperThread: run()");
  24. try {
  25. Thread.sleep(100L);
  26. } catch (InterruptedException e) {
  27. e.printStackTrace();
  28. }
  29. time = Integer.parseInt(stoperLabel.getText());
  30. time++;
  31. stoperLabel.setText(Integer.toString(time));
  32. }
  33. }
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement