I am trying to make a small non-commercial app and make it have a well designed interface, with screen transitions and such. I have every "screen" on separate panels in one JFrame and wish to be able to slide them smoothly when transitioning between panels. Is there any way to accomplish this somewhat easily?
相关问题
- Delete Messages from a Topic in Apache Kafka
- Jackson Deserialization not calling deserialize on
- How to maintain order of key-value in DataFrame sa
- StackExchange API - Deserialize Date in JSON Respo
- Difference between Types.INTEGER and Types.NULL in
This is a typical animation use case. The easiest way is to use animation framework. I'd suggest Trident
I've written a simple program in Java to do simple slide Transitions. You can adapt it to do other things (than sliding).
Here is a link to my implementation: http://www.java-forums.org/entry.php?b=1141
And here is a Listener I wrote to detect a finger drag on the screen:
Hope this helps.
Since you did not accepted an answer yet, may I suggest you the SlidingLayout library? It's a very small library which aim is to create smooth transitions between two layouts of some components. Thus, making a transition between two screens is very easy to do. Here's an example I just made:
The difference between the two transitions relies on two lines of code. You can also create more fancy transitions by applying a different delay on each component, so they appear not all at once but with some timing variations between them.
I hope it may be useful to you :)
Alternatively, you could use this simple animation library, AnimaationClass, to move JComponents about their x and y axes then hide/dispose of them.
This offers decent (basic and smooth) animation.
http://www.teknikindustries.com/downloads.html
It comes with a javadoc if somehow you don't understand.