Results 1 to 2 of 2
  1. #1
    NiNja07 is offline Member
    Join Date
    Jun 2011
    Rep Power

    Default Event based serial data receiving GUI app

    I am currently working on a GUI app, which receives data from a comm serial port and I am using Rxtx API for this. As the data reception is event based I made a separate class from the GUI class and wrote all the methods and event handlers/listeners into it. The problem is I want a text box in GUI class to display the received messages as they are updated and I cant find a solution how to do it. It may be possible to include the event listener in the GUI class but I want a better approach. Any help will be appreciated. Here's my event listener:
    Java Code:
    public void serialEvent(SerialPortEvent arg0) {
                int data;
                    int len = 0;
                    while ( ( data = > -1 )
                        if ( data == '\n' ) {
                        buffer[len++] = (byte) data;
                    System.out.print(new String(buffer,0,len));
                catch ( IOException e )
    Here in place of System.out.print I want it to be displayed on GUI text area.
    Last edited by NiNja07; 06-22-2011 at 09:44 PM.

  2. #2
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    On vacation
    Rep Power


    in place of System.out.print I want it to be displayed on GUI text area.
    Create and display the text area in your GUI.
    Use a text area method to add the text to its display. See setText() and append() for example

Similar Threads

  1. GIOVYNET Java Serial Comm event listener
    By Edudlc in forum New To Java
    Replies: 5
    Last Post: 05-17-2011, 02:38 PM
  2. Event, Message based communication
    By a1prashant in forum New To Java
    Replies: 3
    Last Post: 01-08-2011, 07:43 PM
  3. get data from serial port
    By kishkar20003 in forum New To Java
    Replies: 2
    Last Post: 12-27-2010, 12:33 PM
  4. Replies: 7
    Last Post: 06-22-2010, 10:49 AM
  5. java based implementation on serial communication
    By xll in forum Threads and Synchronization
    Replies: 1
    Last Post: 12-08-2009, 08:45 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts