• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

ticking clock in a swt application

 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi everybody.

I am building an SWT application which serves as a support for a board game (keeping score etc.) and as one of the features it contains a timer as a part of the interface. The idea is to have a label which displays seconds left of the clock and two buttons - start(stop) and reset.

I know this is a typical threading problem - I just need a thread which would tick every second and notify the label about it. However I can't fathom how to code this. I have tried with Timer and TimerTasks, but I always seem to get "org.eclipse.swt.SWTException: Invalid thread access".

Can someone please help me and tell me how to do this? Thanks!
 
Mortimer Mousse
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Solved the problem. I have found a helpful class SWTTimer (in Piccolo package edu.umd.cs.piccolox.swt.SWTTimer) which extends swing timer and can be used in SWT applications. Now it works like a clock !
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
See Display.timerExec().
 
money grubbing section goes here:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic