954,523 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

java prob

Hello;

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

Joey

Joey_Brown
Junior Poster in Training
73 posts since May 2010
Reputation Points: 10
Solved Threads: 1
 

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

hfx642
Posting Pro
515 posts since Nov 2009
Reputation Points: 248
Solved Threads: 105
 

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.

JamesCherrill
Posting Genius
Moderator
6,371 posts since Apr 2008
Reputation Points: 2,130
Solved Threads: 1,073
 

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.

hiddepolen
Posting Whiz in Training
297 posts since Oct 2010
Reputation Points: 82
Solved Threads: 35
 

This question has already been solved

Post: Markdown Syntax: Formatting Help
You