Flip Book in Java / Swing

You, gyu, saw these flip flip books. I want to create the same in Java. I am using JTextArea for a book sheet. I want to know how I can implement the flip effect of a page by overriding the componentPaint method in combination with Mouse / KeyListener, perhaps?

+5
source share
2 answers

You will need to map the existing page to an off-screen buffer, and then convert the buffer to display the page flip.

So,

  • create a buffer off screen with screen size.
  • Get the graphic buffer context and call super.componentPaint with this context
  • Now you have made your page β€œflat” in your screenless buffer.
  • Using the on-screen context,
    • clear area
    • ,
    • - , "" , 3D

, , . "pageIsTurning" "percentageTurned", , . percentTurned, paint, , , reset componentPaint super.componentPaint.

+8

All Articles