swing - Java: How to generate an event from a socket readline()? -


i have messages (lines) coming in tcp socket, (the messages originating can gateway). on selected messages, after selection , parsing, want update swing gui form (e.g. generated in netbeans).

i read swing update must driven event handler, , there many examples, based on button pushes, slider changes, etc., , not incoming socket data, (or serial ports). appears need make handling of 'readline' of socket generate event, don't find examples , given has common problem , maybe i'm on wrong track , there might simpler alternatives.

use swingutilities.invokelater() run arbitrary code on swing event thread. example:

    string stuff = socket.readline();     if (mystuff(stuff)) {         swingutilities.invokelater(new runnable() {             public void run() {                 // updates swing ui here             }         });     } 

Comments

Popular posts from this blog

android - Get AccessToken using signpost OAuth without opening a browser (Two legged Oauth) -

org.mockito.exceptions.misusing.InvalidUseOfMatchersException: mockito -

google shop client API returns 400 bad request error while adding an item -