SWT and threads

B

bilbo

Hi there.

I have a SWT application and would like to use threads (for a ticking clock
for instance). However, I see that SWT package doesn't have Swing's timer,
or SwingUtilities for invoking Runnable objects.

How is this achieved in SWT and is it even possible, or I need to revert
back to Swing? Thanks.
 
M

Marcin Grunwald

bilbo said:
Hi there.

I have a SWT application and would like to use threads (for a ticking
clock for instance). However, I see that SWT package doesn't have Swing's
timer, or SwingUtilities for invoking Runnable objects.

How is this achieved in SWT and is it even possible, or I need to revert
back to Swing? Thanks.

You can do with threads what you want, there aren't any limitations.
Just implement Runnable interface and start it.
If you want to access any SWT components from your thread you have to do it
using for example:

org.eclipse.swt.widgets.Display.getDefault().syncExec(Runnable runnable);

check also:
Display.getCurrent()
Display.asyncExec(Runnable runnable)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

SWT or Swing? 44
SWT 5
SWT Table's scroll event 0
Swt hangs swing gui 1
SWT with GCJ 1
SWT splashscreen 1
SWT and JMF 0
Standalone SWT application on Windows 0

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top