Frage

I am trying to implement SerialPortEventListener but failed. My code is

public class Communicator implements SerialPortEventListener{

My netbeans 7.1 shows mateorssms.Communicator is not abstract and does not override abstract method serialEvent(javax.comm.SerialPortEvent) in javax.comm.SerialPortEventListener. I've successfully imported javax.comm.*;. What is wrong with me?

Thanks in advance...

War es hilfreich?

Lösung

Your Communicator class needs a to implement a method

@Override
public void serialEvent(SerialPortEvent ev) {
  // TODO do something with ev
}

That's all. Add this method stub to your class and the error is gone. Then add some functionality to that method.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top