Owl Teach Yourself Java in 24 Hours, Fifth Edition
HOME / FEEDBACK / ORDER THE BOOK / OTHER BOOKS / PREVIOUS HOUR / NEXT HOUR / THANKS
ROGERS CADENHEAD

Hour 15: Responding to User Input

Online Interactive Learning Lab

How to handle user input in the LottoMadness application by creating the LottoEvent class.

Hour 15 Quiz

Question 1. Why are action events called by that name?

1.a. They occur in reaction to something else

1.b. They indicate that some kind of action should be taken in response

1.c. They honor cinematic adventurer Action Jackson

Action events include the click of a button and the selection of an item from a pull-down menu.

Question 2. What does this signify as the argument to an addActionListener() method?

2.a. this

2.b. this event takes precedence over others

2.c. this object handles the events

The this keyword refers to the current object. If the name of an object is used as an argument instead of the this statement, that object would receive the events and be expected to handle them.

Question 3. Which component stores user input as integers?

3.a. JButton

3.b. JTextField

3.c. Neither does

JTextField and JTextArea components store their values as text, so their values must be converted before they can be used as integers, floating-point numbers, or other nontext values.

Notes and Corrections

  • None.

Source Files

Reader Questions

  • None.

Activities

   
HOME / FEEDBACK / ORDER THE BOOK / OTHER BOOKS / PREVIOUS HOUR / NEXT HOUR / THANKS

Search terms used to find this page: Java programming, teach yourself, 24 hours, how to, learn, Sams, Macmillan, Java2, JDK1.5, Java 1.5, JDK 1.5, SDK1.5, Java 2 SDK 1.5, SDK 1.5, Java 2 version 1.5, J2SE 1.5, J2SE 5, Java 2 Standard Edition 1.5, Java 2 Standard Edition 5, Java 2 SDK, Java SDK, Rogers Cadenhead, tutorial, hands-on, source code, code, javac, java, appletviewer, help, learning, applet, application, Java Plug-in, plugin, Swing, GUI, interface, Java2D, IO, Java Web Start, games, novice, beginner, neophyte, rookie

Valid HTML 4.01!

Valid CSS!