Animation (Java/Swing)

Hi to all! I’m spruzzer and this is the first time I post on this amazing Forum! ;D

I’m developing a card board game and now I’ve rescued difficulty in some animation tasks:

I display all my components (Card deck and user card subset) on a Jpanel.
In the class Card I wrote the draw method and animation method, which move a card from deck to user subset (shifted of 25px for each taken card).
I have no problem when I call(from the game board class) the move method from a mouse pressed event: I click on the user subset and i see the card moving to its destination (I have a timer that repaint the whole panel each 20ms). Now I want to write a method initGame() in the game board class that draw 2 cardsfor each users ut don’t understand ho I can shw the animation (I’m only able to draw the complete set of 2 cards without the moving animation).

I hope that you have time to tell me the right way to solve this problem.

Thanks!

I suggest to show draw animation first and then draw complete set

Hi!

I’ve added a boolean method isMoveFinished that return the moving status of the cards. In the initDeck method the status of all the cards that I want to show/animate is checked if a card is “isMoveFinished -> true” the next one is painted. (The control of the moving status and the moving method are called from the timer listener).