O'Reilly logo

Java™ After Hours: 10 Projects You'll Never Do at Work by Steven Holzner

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

Setting the Speed

To let the user set the value in the speed variable, Slapshot! uses the dialog box shown in Figure 2.2; the user can even open and use this dialog box when the game is playing.

Figure 2.2. The Slapshot! application's dialog box.

This dialog box is opened when the user selects the Set Speed… menu item, menuitem2. In the actionPerformed method, this item simply displays the dialog box textDialog, an object of the OkCancelDialog class that was created in Slapshot!'s constructor. The user enters the new speed in the text field in the dialog box, which Slapshot! can recover using the dialog box's data member, converting the text the ...

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