Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » Call Thread SWT from Swing
Call Thread SWT from Swing [message #1237429] Wed, 29 January 2014 12:53
trelin trelon is currently offline 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);
}
}

}

}
Previous Topic:How to update MenuBar at runtime?
Next Topic:Ruler as in OpenOffice
Goto Forum:
  


Current Time: Sat Aug 23 01:37:29 EDT 2014

Powered by FUDForum. Page generated in 0.01585 seconds