Workshop: A Little Lotto Madness

To see how Swing's event-handling classes work in a Java program, you will finish LottoMadness, the lottery simulation that was begun during Hour 14.

By the way

See what you missed if you didn't read Hour 14? It may have been my finest hour.

At this point, LottoMadness is just a graphical user interface. You can click buttons and enter text into text boxes, but nothing happens in response. In this workshop, you will create LottoEvent, a new class that receives user input, conducts lotto drawings, and keeps track of the number of times you win anything. Once the class is complete, you will add a few lines to LottoMadness so that it makes use of LottoEvent. It is often convenient to divide Swing projects in this ...

Get SAMS Teach Yourself Programming with Java™ in 24 Hours, FOURTH EDITION now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.