Is there a way in java to create a flip card effect. I have two pictures, that are to form a double sided card. Ive come with a way to snapshot them in different angles and finally iterate through them in a loop. Its not very good :) Is there another way?

Basically I need to merge these two pictures together and when a user clicks on them the card flips and displays its back side.

Some examples or links maybe where I could get some further info?

Thank you very much


6 Years
Discussion Span
Last Post by hiddepolen

Sounds like you've got the method right...
You just have to refine the implementation.
Good luck!


I'd be very interested to hear how you did the "snapshot", but yes, there's no way around displaying the incremental stages of the "flipping" graphics in a loop. (But not a loop as such - that's going to mess up Swing's event thread - use a javax.swing.Timer to control the update/repaints).

If you don't need to compute the views on the fly you could maybe use an animated GIF created in Photoshop or whatever to simplify your Java code.

Edited by JamesCherrill: n/a


My idea: make a jPanel for each card, and use an Affine Transform object to:

- Reduce the width of the panel to 0
- Paint the other image
- Enlarge the width of the panel to the previous width

Like James said, you'll need to some some timing.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.