Blackjack

com.amoebacode.blackjack.display
Class CardDisplay

java.lang.Object
  |
  +--com.amoebacode.blackjack.display.DisplayElement
        |
        +--com.amoebacode.blackjack.display.CardDisplay

public class CardDisplay
extends DisplayElement

CardDisplay handles the display of a single card.

Version:
0.9
Author:
Jason Gurney

Field Summary
private  ICard card
          The card being displayed
private  javax.swing.JLabel label
          The label used to display this card
 
Fields inherited from class com.amoebacode.blackjack.display.DisplayElement
parent
 
Constructor Summary
protected CardDisplay(HandDisplay hand, ICard card)
          Default protected constructor.
 
Method Summary
 void clear()
          Removes this card from the primary layered pane.
 boolean equalsCard(ICard otherCard)
          Indicates whether the card being displayed is equal to the specified card.
 int getIconHeight()
          Returns the height of this card's image.
 int getIconWidth()
          Returns the width of this card's image.
private  java.lang.String getImageName()
          Returns the filename of the image that corresponds to this card.
 javax.swing.JLabel getLabel()
          Returns the label used to display this card.
 void hide()
          Hides this card.
private  void setupCardLabel()
          Sets up the card label for this display.
 
Methods inherited from class com.amoebacode.blackjack.display.DisplayElement
executeGameCommand, getDisplayManager, getGameDisplay, getParent, hasParent, playGameClip, queueAction, resumeQueue
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

card

private ICard card
The card being displayed

label

private javax.swing.JLabel label
The label used to display this card
Constructor Detail

CardDisplay

protected CardDisplay(HandDisplay hand,
                      ICard card)
Default protected constructor.
Parameters:
hand - the parent HandDisplay
card - the ICard being displayed
Method Detail

setupCardLabel

private void setupCardLabel()
Sets up the card label for this display.

getIconWidth

public int getIconWidth()
Returns the width of this card's image.
Returns:
this card's image width

getIconHeight

public int getIconHeight()
Returns the height of this card's image.
Returns:
this card's image height

hide

public void hide()
Hides this card.

clear

public void clear()
Removes this card from the primary layered pane.

getLabel

public javax.swing.JLabel getLabel()
Returns the label used to display this card.
Returns:
this card's label

getImageName

private java.lang.String getImageName()
Returns the filename of the image that corresponds to this card.
Returns:
the image filename

equalsCard

public boolean equalsCard(ICard otherCard)
Indicates whether the card being displayed is equal to the specified card.
Parameters:
otherCard - the ICard being compared
Returns:
true if the specified card is equal to this card

Blackjack

Copyright © 2002 amoebacode.com.