I am getting a compile time error with Java:
MyClass is not abstract and does not override abstract method
onClassicControllerRemovedEvent(
wiiusej.wiiusejevents.wiiuseapievents.ClassicControllerRemovedEvent)
in wiiusejevents.utils.WiimoteListener)
Here is the class:
import wiiusej.WiiUseApiManager;
import wiiusej.Wiimote;
import wiiusej.wiiusejevents.physicalevents.ExpansionEvent;
import wiiusej.wiiusejevents.physicalevents.IREvent;
import wiiusej.wiiusejevents.physicalevents.MotionSensingEvent;
import wiiusej.wiiusejevents.physicalevents.WiimoteButtonsEvent;
import wiiusej.wiiusejevents.utils.WiimoteListener;
import wiiusej.wiiusejevents.wiiuseapievents.DisconnectionEvent;
import wiiusej.wiiusejevents.wiiuseapievents.NunchukInsertedEvent;
import wiiusej.wiiusejevents.wiiuseapievents.NunchukRemovedEvent;
import wiiusej.wiiusejevents.wiiuseapievents.StatusEvent;
public class MyClass implements WiimoteListener{
public void onButtonsEvent(WiimoteButtonsEvent arg0) {
System.out.println(arg0);
if (arg0.isButtonAPressed()){
WiiUseApiManager.shutdown();
}
}
public void onIrEvent(IREvent arg0) {
System.out.println(arg0);
}
public void onMotionSensingEvent(MotionSensingEvent arg0) {
System.out.println(arg0);
}
public void onExpansionEvent(ExpansionEvent arg0) {
System.out.println(arg0);
}
public void onStatusEvent(StatusEvent arg0) {
System.out.println(arg0);
}
public void onDisconnectionEvent(DisconnectionEvent arg0) {
System.out.println(arg0);
}
public void onNunchukInsertedEvent(NunchukInsertedEvent arg0) {
System.out.println(arg0);
}
public void onNunchukRemovedEvent(NunchukRemovedEvent arg0) {
System.out.println(arg0);
}
public static void main(String[] args) {
Wiimote[] wiimotes = WiiUseApiManager.getWiimotes(1, true);
Wiimote wiimote = wiimotes[0];
wiimote.activateIRTRacking();
wiimote.activateMotionSensing();
wiimote.addWiiMoteEventListeners(new MyClass());
}
}
Can I get a better explanation of what this error means?
Your class implements an interface WiimoteListener
, which has a method onClassicControllerRemovedEvent
. However, the methods in interfaces are abstract
, which means they are essentially just contracts with no implementations. You need to do one of the things here: