The Java TM Tutorial

| Start of Tutorial > Start of Trail > Start of Lesson | Search

Trail: Putting It All Together
Lesson: BINGO!

## The Classes in bingo.player

> The following lists and describes all the classes in the `bingo.player` package.
> - `Player`-- the main program for the Player application.

>   When invoked, this class creates the UI for the Player application, implemented by `ControlPane`, `bingo.shared.LightBoardPane`, and `bingo.shared.GameStatusLabel`, and initializes it with the last-saved program settings. The Player class also creates a `PlayerQueue` which is used to serialize RMI calls to the Game application.

> - `ControlPane`-- implements the area of the Player's UI that lets the user change program settings and register for a game.

> - `CardWindow`-- implements a window that the Player uses to display BINGO cards.

>   The Player application displays one `CardWindow` per card being played in the current game. `CardWindow` creates a `PaperPane` for the background of the BINGO card and 25 `NumberButton`s, one for each space on the BINGO card.

> - `PaperPane`-- a simple class that is used to display the background for `CardWindow`.

> - `NumberButton`-- a class used to implement each number on a BINGO card (used by `CardWindow`).

> - `PlayerParameters`-- keeps track of all the program settings for the Player application.

>   These settings include whether or not the application should beep to announce new balls, the player's name, the name of the machine on which the Game application is running, the number of cards to play in each game, and the random number seed used to generate the cards. Also, this class, as a subclass of `bingo.shared.Parameters`, converts the program settings to `Properties`, saves them to the file system whenever a change takes effect, and reads them in on start up.

> - `PlayerQueue`-- a subclass of `java.awt.EventQueue` used by the Player to serialize RMI calls to the Game application.

>   The Player application posts events to this queue for each RMI call to the Game. The Player can invoke any one of three different remote methods in the Game. Each remote method is represented by one of these event classes: `RegisterEvent`, `StatusRequestEvent`, and `IWonEvent`. When `PlayerQueue` processes an event in the queue, it makes the appropriate RMI call.

> - `RegisterEvent`-- the event representing a remote method call to the Game application's `mayIPlay` method.

> - `StatusRequestEvent`-- the event representing a remote method call to the Game application's `whatsHappening` method.

> - `IWonEvent`-- the event representing a remote method call to the Game application's `BINGO` method.

| Start of Tutorial > Start of Trail > Start of Lesson | Search