SWT and threads

Discussion in 'Java' started by bilbo, Apr 14, 2005.

  1. bilbo

    bilbo Guest

    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.
     
    bilbo, Apr 14, 2005
    #1
    1. Advertising

  2. bilbo wrote:

    > 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)

    --
    Cheers
    grundig
     
    Marcin Grunwald, Apr 15, 2005
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Dave Benjamin

    SWT and public fields

    Dave Benjamin, Dec 17, 2003, in forum: Java
    Replies:
    0
    Views:
    351
    Dave Benjamin
    Dec 17, 2003
  2. soni29

    swt drag and drop to native?

    soni29, Dec 24, 2003, in forum: Java
    Replies:
    0
    Views:
    435
    soni29
    Dec 24, 2003
  3. Oren Tirosh
    Replies:
    6
    Views:
    1,791
    Oren Tirosh
    Dec 18, 2003
  4. Ramon F Herrera

    Where can I download SWT? (SWT homepage)

    Ramon F Herrera, Dec 5, 2007, in forum: Java
    Replies:
    11
    Views:
    4,113
    Ramon F Herrera
    Dec 6, 2007
  5. Une bévue
    Replies:
    0
    Views:
    187
    Une bévue
    Jun 14, 2006
Loading...

Share This Page