Results 1 to 6 of 6
  1. #1
    Edudlc is offline Member
    Join Date
    May 2011
    Posts
    3
    Rep Power
    0

    Default GIOVYNET Java Serial Comm event listener

    Hi all,

    I'm using Giovynet drivers to manage serial port communication with Java for windows.

    I'm trying to read serial port through an event listener but I have problems. I implemented the same example as quick start guide.

    I attached the code, I have problems with the red colour word

    Please, anyone could help me?

    thanks,

    import giovynet.serial.ActionListenerReadPort;
    import giovynet.serial.Baud;
    import giovynet.serial.Buffer;
    import giovynet.serial.Com;
    import giovynet.serial.Parameters;


    public class ListenerRead {

    private static Com com1;
    public static void main(String[] args)throws {

    Parameters param = new Parameters();
    param.setPort("COM1");
    param.setBaudRate(Baud._9600);
    com1 = new Com(param);

    com1.addActionListenerReadPort(new ActionListenerReadPort()
    {
    public void tryActionPerformed(Buffer buffer) {
    appendLineTextArea("\n<< ");
    for (int i = 0; i < buffer.getBufferInIntegerList().size();
    i++) {
    System.out.print(buffer.getBufferInIntegerList().g et(i));
    }
    buffer.bufferClear();
    }
    public void catchActionPerformed(Exception e) {
    com1.close();
    }
    });
    /** Other Routines Thread Main
    ...
    ...
    ...
    **/
    }
    }

  2. #2
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,397
    Rep Power
    25

    Default

    I have problems
    Please copy and paste here the full text of the error messages.

  3. #3
    Edudlc is offline Member
    Join Date
    May 2011
    Posts
    3
    Rep Power
    0

    Default

    Error nș 1)
    public static void main(String[] args)throws { --->Syntax error on token "throws", ClassType expected after this token

    Error nș2)
    public void tryActionPerformed(Buffer buffer) {
    appendLineTextArea("\n<< "); --------------> (The method appendLineTextArea(String) is undefined for the type new ActionListenerReadPort(){})

    Thanks, :)

  4. #4
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,397
    Rep Power
    25

    Default

    If you read the error messages, they explain what the problem is.
    Syntax error on token "throws", ClassType expected after this token
    method appendLineTextArea(String) is undefined

  5. #5
    Edudlc is offline Member
    Join Date
    May 2011
    Posts
    3
    Rep Power
    0

    Default

    Yes, of course,

    I'm new in Java language and I don't know the way to solve it.

    I implemented the same example as here.

    http://www.giovynet.com/docs/giovyne...tDriverEng.pdf
    Page 7.

    I'm using ECLIPSE instead NetBeans, could be a problem?

    Thanks,

  6. #6
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,397
    Rep Power
    25

    Default

    Go back and reread the PDF file. The first error you have is because you didn't copy what is shown in the pdf.

Similar Threads

  1. how to add event Listener to Image
    By shane5317 in forum Java 2D
    Replies: 3
    Last Post: 03-13-2011, 11:36 AM
  2. Serial Comm freeze
    By java_dude in forum Networking
    Replies: 3
    Last Post: 01-13-2011, 10:09 PM
  3. GIOVYNET Java Serial Comm Port Question
    By the_justin in forum New To Java
    Replies: 1
    Last Post: 11-30-2010, 12:13 PM
  4. JColorChooser modeless - Event Listener problem
    By siamino in forum New To Java
    Replies: 1
    Last Post: 04-14-2009, 12:39 AM
  5. Listener for SWT event
    By Java Tip in forum Java Tip
    Replies: 0
    Last Post: 01-08-2008, 09:04 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
  •