一直在使用适当的向导创建一堆 JFrame
类。
创建了一个接口(interface)并决定让 JFrame
类实现这个接口(interface)。通常,在类中添加 implements CaptureObserver
语句时,类声明带有红色下划线,错误是说
System.Bill.Operation.BillForm is not abstract and does not override abstract method onError(com.lti.civil.CaptureStream,com.lti.civil.CaptureException) in com.lti.civil.CaptureObserver
我该如何解决?
最佳答案
您需要实现接口(interface)中定义的方法。
如果你有这个:
public interface CaptureObserver {
public void onError(CaptureStream stream, CaptureException exc);
}
那么你需要这个:
public class BillForm extends JFrame implements CaptureObserver {
// Don't forget your constructor
public BillForm() {
super();
}
@Override
public void onError(CaptureStream stream, CaptureException exc) {
// Code
}
}
关于java - 实现 jframe 类的接口(interface),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22241947/