• Previous
  • Next

    Using the Mouse and Keyboard

    "Now press any key; where's the 'any' key?"
    -Homer Simpson

    Introduction

    The ability to read input into a program is a major step in the process of creating Java games. In this chapter we first of all use some simple examples to show how keyboard and mouse events are read into an applet and app, respectively, and then we look at some more advanced techniques for reading the input. In the previous chapter we learned how to display graphics, which together with the subject of this chapter gives us the ability to make real-time games.

    • Previous
    • Next