Chapter 16

Responding to Keystrokes and Mouse Clicks

IN THIS CHAPTER

check Creating code to handle mouse clicks

check Responding when the user presses a key or selects a drop down box item

check Putting classes inside of other classes

In the late 1980s, I bought my first mouse. I paid $100 and, because I didn’t really need a mouse, I checked with my wife before buying it. (At the time, my computer ran a hybrid text/windowed environment. Anything that I could do with a mouse, I could just as easily do with the Alt key.)

Now it’s the 21st century. The last ten mice that I got were free. Ordinary ones just fall into my lap somehow. A few exotic mice were on sale at the local computer superstore. One cost $10 and came with a $10 rebate.

As I write this chapter, I’m using the most recent addition to my collection: an official For Dummies mouse. This yellow-and-white beauty has a little compartment filled with water. Instead of a snowy Atlantic City scene, the water surrounds a tiny Dummies Man charm. It’s so cute. It was a present from the folks at Wiley Publishing.

Go On … Click That Button

In previous chapters, I create windows that don’t do much. A typical window displays some information but ...

Get Java For Dummies, 7th Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.