Created
November 6, 2010 17:46
-
-
Save eduardodaluz/665567 to your computer and use it in GitHub Desktop.
MyThread.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package br.com.bitmasters.swt; | |
import org.eclipse.swt.widgets.ProgressBar; | |
import org.eclipse.swt.widgets.Text; | |
public class MyThread implements Runnable{ | |
private Text txStatus; | |
private ProgressBar pbStatus; | |
public MyThread(Text txStatus, ProgressBar pbStatus) { | |
this.txStatus = txStatus; | |
this.pbStatus = pbStatus; | |
} | |
private void begin() { | |
txStatus.setText("Alterado pela Thread: " + Thread.currentThread().getName()); | |
pbStatus.setMaximum(10); | |
try { | |
for (int i = 0; i <= 10; i++) { | |
pbStatus.setSelection(i); | |
Thread.sleep(3000); | |
} | |
} catch (InterruptedException e) { | |
e.printStackTrace(); | |
} | |
} | |
@Override | |
public void run() { | |
begin(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment