Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import javax.swing.*;
- import java.text.ParseException;
- /**
- * Created by Asmonix on 2018-01-16.
- */
- public class StoperThread implements Runnable {
- JLabel stoperLabel;
- public StoperThread(JLabel lab){
- this.stoperLabel=lab;
- Thread thread = new Thread();
- thread.start();
- }
- @Override
- public void run() {
- int time;
- while(true){
- System.out.println("StoperThread: run()");
- try {
- Thread.sleep(100L);
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- time = Integer.parseInt(stoperLabel.getText());
- time++;
- stoperLabel.setText(Integer.toString(time));
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement