cardDeck
Class Card

java.lang.Object
  extended by cardDeck.Card

public class Card
extends java.lang.Object

Represents a playing card in a deck of cards.

Version:
0.5
Author:
Devin Ryan

Constructor Summary
Card(javax.swing.ImageIcon image, Suit aSuit, Face aFace, int numericValue)
           
 
Method Summary
 void draw(java.awt.Graphics g, java.awt.Component c)
          Draws either face or back.
static javax.swing.ImageIcon getCardBackImg()
           
 Face getFace()
           
 int getHeight()
           
 Suit getSuit()
           
 int getValue()
           
 int getWidth()
           
 int getX()
           
 int getY()
           
 boolean isInside(int x, int y)
          Given a point, it tells whether this is inside card image.
 void moveTo(int x, int y)
          Moves a card to a position on the screen, which is implementation dependent.
static void setCardBackImg(int choice)
          Set the card back image to the choice
 void setX(int x)
          Sets x-coordinate of this card
 void setY(int y)
          Sets the y coordinate of this card
 java.lang.String toString()
          Prints card as a string
 void turnFaceDown()
          Turns card face down
 void turnFaceUp()
          Turns card face up
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Card

public Card(javax.swing.ImageIcon image,
            Suit aSuit,
            Face aFace,
            int numericValue)
Method Detail

moveTo

public void moveTo(int x,
                   int y)
Moves a card to a position on the screen, which is implementation dependent.

Parameters:
x - x-coordinate of the cards position
y - y-coordinate of the cards position

getSuit

public Suit getSuit()
Returns:
The suit of this card

getFace

public Face getFace()
Returns:
The face of this card

getValue

public int getValue()
Returns:
The numeric value of this card

getWidth

public int getWidth()
Returns:
the width of the icon

getHeight

public int getHeight()
Returns:
the height of the icon

getX

public int getX()
Returns:
The x position of the card

getY

public int getY()
Returns:
The y position of the card

setX

public void setX(int x)
Sets x-coordinate of this card

Parameters:
x - Value of new x-coord

setY

public void setY(int y)
Sets the y coordinate of this card

Parameters:
y - Value of new y-coord

isInside

public boolean isInside(int x,
                        int y)
Given a point, it tells whether this is inside card image. Used to determine if mouse was pressed in card.


toString

public java.lang.String toString()
Prints card as a string

Overrides:
toString in class java.lang.Object

turnFaceUp

public void turnFaceUp()
Turns card face up


turnFaceDown

public void turnFaceDown()
Turns card face down


getCardBackImg

public static javax.swing.ImageIcon getCardBackImg()
Returns:
The current image for the back of cards

setCardBackImg

public static void setCardBackImg(int choice)
Set the card back image to the choice

Parameters:
choice - int representing image number to be used.

draw

public void draw(java.awt.Graphics g,
                 java.awt.Component c)
Draws either face or back.