O'Reilly logo

Java™ ME Game Programming, Second Edition by Ph.D. Martin J. Wells, Ph.D. John P. Flynt

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

GSCanvas Definition and Construction

When the user presses the button corresponding to the Start command in the Form object the GameStart MIDlet provides, an instance of the GSCanvas class is created and the user enters into the event context sustained by the GSCanvas event handlers. To make this possible, immediately following comment #1 in the signature line of the GSCanvas class, you extend the Canvas class and implement the Runnable and CommandListener interfaces. The Runnable interface makes it necessary to implement the run() method. The GSCanvas class supports an instance of the Thread class, and when the Thread object is used to call the start() method, the run() method is also called. In addition to the use of a Thread, this implementation ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required