|
Blackjack | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object
|
+--com.amoebacode.blackjack.display.DisplayElement
|
+--com.amoebacode.blackjack.display.AnimatedCard
AnimatedCard handles drawing cards as they move from the deck to the hand.
| Field Summary | |
private Coordinate |
beginPos
The intial position of the card to be animated |
private int |
cardIndex
The index of this card within its hand |
private javax.swing.JLabel |
cardLabel
The label element that draws this animated card |
private Coordinate |
currentPos
The current position of the animated card |
private Coordinate |
endPos
The final position of the card to be animated |
private HandDisplay |
hand
The hand this card belongs to |
private javax.swing.Timer |
timer
The timer which handles the animation delay |
| Fields inherited from class com.amoebacode.blackjack.display.DisplayElement |
parent |
| Constructor Summary | |
protected |
AnimatedCard(HandDisplay hand,
int cardIndex,
Coordinate beginPos,
Coordinate endPos)
Default protected constructor. |
| Method Summary | |
void |
actionPerformed(java.awt.event.ActionEvent e)
Performs one card movement (called when the timer expires). |
private int |
getAnimationDelay()
Returns the animation delay from the Preferences object. |
private int |
getBeginXPos()
Returns the initial horizontal position. |
private int |
getBeginYPos()
Returns the initial vertical position. |
private int |
getPixelsPerMove()
Returns the number of pixels to move from the Preferences object. |
private void |
setCurrentPosition()
Moves the current position toward the final position. |
void |
startAnimation()
Begins the animation by starting the timer. |
private void |
stopAnimation()
Finishes the animation by stopping the timer, then returns control to the hand that contains this card. |
| Methods inherited from class com.amoebacode.blackjack.display.DisplayElement |
executeGameCommand, getDisplayManager, getGameDisplay, getParent, hasParent, playGameClip, queueAction, resumeQueue |
| Methods inherited from class java.lang.Object |
|
| Field Detail |
private Coordinate beginPos
private Coordinate endPos
private Coordinate currentPos
private javax.swing.Timer timer
private HandDisplay hand
private javax.swing.JLabel cardLabel
private int cardIndex
| Constructor Detail |
protected AnimatedCard(HandDisplay hand,
int cardIndex,
Coordinate beginPos,
Coordinate endPos)
hand - the Hand this card belongs tocardIndex - the index of this card within its handbeginPos - the initial position of the card to be animatedendPos - the final position of the card to be animated| Method Detail |
public void actionPerformed(java.awt.event.ActionEvent e)
actionPerformed in interface java.awt.event.ActionListenere - the ActionEven that triggered this actionpublic void startAnimation()
private void setCurrentPosition()
private void stopAnimation()
private int getBeginXPos()
private int getBeginYPos()
private int getAnimationDelay()
private int getPixelsPerMove()
|
Blackjack | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||