📄 mythread.java
字号:
import java.util.Random;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Group;
import org.eclipse.swt.widgets.ProgressBar;
import org.eclipse.swt.widgets.Scale;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Spinner;
class Mythread extends Thread{
int sd=0;
private int i=0;
public threadtest thisme;
int sleeptime=0;
boolean taskrun=true;
public boolean sleeptrue=false;
public Mythread(threadtest thisme) {
this.thisme=thisme;
}
public void run() {
while (true) {
if(i>100|i==0){
i=0;
sd1();
}
i++;
if(sleeptrue){
try {
Thread.sleep(sleeptime);
sleeptrue=false;
} catch (InterruptedException e) {
// TODO 自动生成 catch 块
e.printStackTrace();
}
}
sds();
try {
Thread.sleep(100-sd);
} catch (InterruptedException e) {
// TODO 自动生成 catch 块
e.printStackTrace();
}
}
}
private void sd1() {
Display.getDefault().syncExec(new Runnable() {
public void run() {
thisme.sd();
}
});
}
private void sds() {
Display.getDefault().syncExec(new Runnable() {
public void run() {
// System.out.println(i);
thisme.sd(i);
}
});
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -