站内搜索: 请输入搜索关键词
当前页面: 在线文档首页 > Java Tutorial 5.0 英文版

The Classes in the bingo.player Package - Java Tutorial 5.0 英文版

The JavaTM Tutorial
Previous Page Lesson Contents Next Page Start of Tutorial > Start of Trail > Start of Lesson Search
Feedback Form

Trail: Putting It All Together
Lesson: BINGO!

The Classes in the bingo.player Package

The following lists and describes all the classes in the bingo.player package.
  • Player (in a .java source file)-- 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 (in a .java source file)-- implements the area of the Player's UI that lets the user change program settings and register for a game.

  • CardWindow (in a .java source file)-- 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 NumberButtons, one for each space on the BINGO card.

  • PaperPane (in a .java source file)-- a simple class that is used to display the background for CardWindow.

  • NumberButton (in a .java source file)-- a class used to implement each number on a BINGO card (used by CardWindow).

  • PlayerParameters (in a .java source file)-- 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 (in a .java source file)-- 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 (in a .java source file)-- the event representing a remote method call to the Game application's mayIPlay method.

  • StatusRequestEvent (in a .java source file)-- the event representing a remote method call to the Game application's whatsHappening method.

  • IWonEvent (in a .java source file)-- the event representing a remote method call to the Game application's BINGO method.


Previous Page Lesson Contents Next Page Start of Tutorial > Start of Trail > Start of Lesson Search
Feedback Form

Copyright 1995-2005 Sun Microsystems, Inc. All rights reserved.