Game Development Reference
In-Depth Information
Figure 7-7 . Take a coding shortcut: press Alt+Enter to bring up a helper dialog, and select Implement all abstract
methods
Note that the an @Override keyword precedes the public void handle method ac-
cess keyword, return type keyword, and method name. This tells the Java compiler that
your .handle() method is going to replace (override) AnimationTimer's .handle() meth-
od, which is why the error indicates that you have to override abstract method
.handle(long) .
You certainly do not want your .handle() method to throw 60 UnsupportedOpera-
tionException() errors every single second of your game loop; however, you are going
to leave this in there for now so that you can see what it does and also learn a bit more
about the NetBeans error console.
As Figure 7-8 demonstrates, once you select the Implement all abstract methods
option, the Java code is error free, and the basic package-import-class-method structure
for the class is in place. Now, you should be able to create a GamePlayLoop object us-
ing this class, so let's switch gears and do some programming in the InvinciBagel Java
class, in which you create a GamePlayLoop object, and then profile the application to
see what it does.
 
 
Search WWH ::




Custom Search