Call Thread SWT from Swing [message #1237429] |
Wed, 29 January 2014 17:53 |
trelin trelon Messages: 1 Registered: January 2014 |
Junior Member |
|
|
How to call swt thread in Swing component ?
thanks
...
public MyApp extends javax.swing.JFrame {
SWT_thread swt_thread = new SWT_thread();
public MyApp() {
super.setSize(200,200);
super.setVisible(true);
...
swt_thread.start(); // <---- here call thread, but not SWT
}
...
}
public class SWT_thread extends Thread {
Display display;
Shell shell;
public SWT_thread() {
display = new Display();
shell = new Shell(display);
}
public void run() {
for(int x=0; x < 1000000; x++ ) {
Print("This command call, correct" );
// but, not call this instruction SWT
display.asyncExec(new Runnable() {
public void run() {
GC gc = new GC(display);
Image image = new Image(display, 800, 600 );
gc.copyArea(image , 0, 0);
gc.dispose();
}
...
Thread.sleep(100);
}
}
}
}
|
|
|
Powered by
FUDForum. Page generated in 0.03535 seconds