Skip to content

Instantly share code, notes, and snippets.

@eduardodaluz
Created November 6, 2010 17:46
Show Gist options
  • Save eduardodaluz/665567 to your computer and use it in GitHub Desktop.
Save eduardodaluz/665567 to your computer and use it in GitHub Desktop.
MyThread.java
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