October 2011
Beginner
432 pages
10h 18m
English
To see how Swing’s event-handling classes work in a Java program, you finish LottoMadness, the lottery simulation begun during Hour 14, “Laying Out a User Interface.”
At this point, LottoMadness is just a GUI. You can click buttons and enter text into text boxes, but nothing happens in response. In this workshop, you create LottoEvent, a new class that receives user input, conducts lotto drawings, and keeps track of the number of times you win. When the class is complete, you add a few lines to LottoMadness so that it makes use of LottoEvent. It often is convenient to divide Swing projects in this manner, with the GUI in one class and the event-handling methods in another.
The purpose of this application is ...
Read now
Unlock full access