Bookmark Topic Watch Topic
  • New Topic

how can I have swt widget listen to SerialPortEvent  RSS feed

 
matt burns
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Report post to moderator
I have a SerialPortEventListener which is quite happily listening to a SerialPortEvent's.

However, I want to add a listener to my label widget so that I can update it's text if a SerialPortEvent is fired.

I know this should be simple, but I've been coding to the point I'm going blind and my brain has stopped.

Can someone help please?!!

Thanks, Matt.
 
Ernest Friedman-Hill
author and iconoclast
Sheriff
Posts: 24217
38
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Report post to moderator
Hi Matt,

Welcome to JavaRanch!

This is one of those times where you just need someone to tell you what you already know:

You need another SerialPortListener, and in its handler method, you need to put the SWT code to update the label's text (using asyncExec(), presumably.) Set the listener up from code (somewhere) which has references to all the necessary objects (the Label, the Display, the serial-port stuff).

Make sense?
 
matt burns
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Report post to moderator
Cheers Ernest,

I have it all working brilliantly now. (I haven't done gui stuff in years!)
 
Fernando Hood
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Report post to moderator
Since you have this working any possibilty you can share how you did it?

I want to do the same thing.
 
Nathan Pruett
Bartender
Posts: 4121
IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Report post to moderator
You already have your own thread to ask your question... please don't pull up old threads. Closing this one.
 
It is sorta covered in the JavaRanch Style Guide.
    Bookmark Topic Watch Topic
  • New Topic
Boost this thread!