Class TamaGUI

java.lang.Object
  |
  +--GBFrame
        |
        +--TamaGUI

public class TamaGUI
extends GBFrame

See Also:
Serialized Form

Constructor Summary
TamaGUI(Tamagochi gochi)
          Creates a new Tamagochi GUI using the specified Tamagochi object.
 
Method Summary
 void buttonClicked(java.awt.Button buttonObj)
          Responds to button clicks in the Tamagochi GUI.
 void update(java.lang.String status, int energy, int health)
          Updates the Tamagochi GUI to show the current status.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TamaGUI

public TamaGUI(Tamagochi gochi)
Creates a new Tamagochi GUI using the specified Tamagochi object. This method gets called automatically when you run the Tamagochi application. This method should store the Tamagochi object as an instance variable, and set up some labels, text and integer fields, and buttons for the GUI.

Parameters:
gochi - the Tamagochi object accessed by this GUI
Method Detail

update

public void update(java.lang.String status,
                   int energy,
                   int health)
Updates the Tamagochi GUI to show the current status. This method gets called automatically by the Tamagochi application at each time step. This method should set the values in the status, energy, and health fields to the values of the arguments.

Parameters:
status - the Tamagochi's status ("Asleep" or "Awake")
energy - the Tamagochi's energy, based on how much it's eaten
health - the Tamagochi's health, based on how much it's slept

buttonClicked

public void buttonClicked(java.awt.Button buttonObj)
Responds to button clicks in the Tamagochi GUI. This method should check which button has been clicked. Clicking the Sleep button should result in calling the Tamagochi object's sleep method. Clicking the Wake button should result in calling the Tamagochi object's wake method. Clicking the Feed button should result in calling the Tamagochi object's feed method. Clicking the Quit button should result in calling the Tamagochi object's quit method.

Parameters:
buttonObj - the button that was clicked