Skip to main content


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 17:53
trelin trelon is currently offline trelin trelonFriend
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: Thu Apr 18 22:55:40 GMT 2024

Powered by FUDForum. Page generated in 0.01598 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top