chcialbym zrobic akutalizacje pola tekstowego poprzez watki, napisalem taki program i... nie chodzi mi :(
moze ktos napisze jakies sugestie, bo siedze juz nad tym jakis czas i zaczyna mnie to irytowac...
public class aplikacja2 {
private Shell sShell = null;
private Text text = null;
private int i =0;
public static void main(String[] args) {
Display display = Display.getDefault();
aplikacja2 thisClass = new aplikacja2();
thisClass.createSShell();
thisClass.sShell.open();
while (!thisClass.sShell.isDisposed()) {
if (!display.readAndDispatch())
display.sleep();
}
display.dispose();
}
private void createSShell() {
sShell = new Shell();
sShell.setText("Shell");
sShell.setSize(new Point(300, 200));
text = new Text(sShell, SWT.BORDER);
text.setBounds(new org.eclipse.swt.graphics.Rectangle(89,73,149,80));
new Thread() {
public void run(){
while (true){
try {
i++;
Thread.sleep(1000);
text.setText(">"+i);
System.out.println(">"+i);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
}.start();
}
}
wysypuje sie na linii
text.setText(">"+i);
moze mi ktos pomoc??