質問

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...

役に立ちましたか?

解決

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.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top