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

The Classes in the bingo.shared 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.shared Package

The following lists and describes all the classes in the bingo.shared package.
  • Registrar (in a .java source file)-- an interface

    This interface is implemented by bingo.game.RegistrarImpl and defines the three remote methods supported by the Game application that can be called by the Player. One method is called by the Player to register for a game, one is called by the Player to claim BINGO, and one is called to get status from the Game.

  • Constants (in a .java source file)-- an interface that contains a collection of game constants.

    One constant define in this file is the port number used by the Game to broadcast packets to the Player. Three other constants are group names used to categorize the broadcast packets into three types of information: balls, player status updates, and game status updates.

  • ErrorMessages (in a .java source file)-- this class contains a collection of static methods that both the Game and the Player can call to print error messages.

  • BingoBall (in a .java source file)-- a BINGO ball.

    Used extensively by Card and BallAnnouncer.

  • Card (in a .java source file)-- a BINGO card.

    Each space on the card contains a BingoBall. Created and signed by the Game.

  • Ticket (in a .java source file)-- an instance of this class is created by the Registrar when a Player registers and returned to the Player.

    It contains the Player's ID, cards, and other information needed by the Player to play.

  • PlayerRecord (in a .java source file)-- represents a Player.

    Used by the Registrar and PlayerInfoPane to keep track of players.

  • Answer (in a .java source file)-- returned to the Player when the Player claims BINGO.

    This class informs the Player whether or not they actually won.

  • OverallStatusPane (in a .java source file)-- implements the Game status UI.

    This window creates a LightBoardPane, PlayerInfoPane, and a GameStatusLabel. This is general enough that it could be used by the Player or another application.

  • PlayerInfoPane (in a .java source file)-- used by the Game to display the players that are registered in this game.

    This Pane is a PlayerListener and uses a PlayerListenerThread to listen for player status updates on the MulticastSocket.

  • PlayerInfoModel (in a .java source file)-- controls the content of the table that lists the currently registered players.

  • GameStatusLabel (in a .java source file)-- used by the Player and by the Game to display game status.

    This Label is a GameListener and uses a GameListenerThread to listen for game status updates on the MulticastSocket.

  • LightBoardPane (in a .java source file)-- used by the Player and by the Game to display the balls that have been announced in this game.

    This particular status pane works differently than the PlayerInfoPane and GameStatusLabel. This Pane is not a BallListener and doesn't use a BallListenerThread, but must be created and informed of announced balls by a BallListener using a BallListenerThread. This is because the information is needed at a higher level in each program (the BallAnnouncer throws an end-of-game ball which has implications for the rest of the program).

  • Parameters (in a .java source file)-- an abstract class that manages program parameters.

    Both the Player and the Game applications have concrete subclasses of this class to manage their program parameters.

  • Utilities (in a .java source file)-- a class with a couple of useful methods for positioning Swing components.

    This class is only used by the Player application, but could be used by other applications.

  • Listener (in a .java source file)-- an empty interface whose sole purpose is to be a superinterface to BallListener, PlayerListener and GameListener.

  • ListenerThread (in a .java source file)-- the abstract superclass of BallListenerThread, PlayerListenerThread, and GameListenerThread.

    This class is a subclass of Thread provides a constructor which must be called by its subclass's constructors. Additionally, this class provides the stopListening method for its subclasses.

  • BallListener (in a .java source file)-- an interface that defines the methods a class must implement in order to listen to balls as they are announced.

    This interface is implemented by bingo.shared.OverallStatusPane and bingo.player.Player. A BallListener uses a BallListenerThread to listen to a MulticastSocket for announced balls. The thread notifies its BallListener of interesting activities on the socket.

  • BallListenerThread (in a .java source file)-- a subclass of ListenerThread that receives balls from the MulticastSocket as they are sent by the Game.

    This thread is created with a BallListener which is informed of each ball as it is announced.

  • PlayerListener (in a .java source file)-- an interface that defines the methods a class must implement in order to listen to player status updates.

    A PlayerListener uses a PlayerListenerThread to listen to a MulticastSocket for player status messages. The thread notifies its PlayerListener of interesting activities on the socket. PlayerInfoPane implements this interface and creates a PlayerListenerThread for listening.

  • PlayerListenerThread (in a .java source file)-- a subclass of ListenerThread that gets player status updates from the MulticastSocket as they are sent by the Game.

    This thread is created with a PlayerListener which is informed of status messages as they are received.

  • GameListener (in a .java source file)-- an interface that defines the methods a class must implement in order to listen to game status updates.

    A GameListener uses a GameListenerThread to listen to a MulticastSocket for game status messages. The thread notifies its GameListener of interesting activities on the socket. GameStatusLabel implements this interface and creates GameListenerThread for listening.

  • GameListenerThread (in a .java source file)-- a subclass of ListenerThread that gets game status updates from the MulticastSocket as they are sent by the RingMaster.

    This thread is created with a GameListener which is informed of status messages as they are received.

  • BingoException (in a .java source file), NoMoreBallsException (in a .java source file)-- exceptions for the BINGO game.

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.