JPanel panel = new JPanel();
AnimatingCardLayout layout = new AnimatingCardLayout();
layout.setAnimation(new DashboardAnimationCardLayout()); // if
someone wants to provide their own animation
panel.setLayout(layout);
panel.add(comp1, "page1");
panel.add(comp2, "page2");
and then in the code you can just use layout.show(panel, "page1");
In principle you can put more than 2 panels (I just used the original
CardLayout) and also the next(), previous() etc. methods.
If no Animation is specified the default one is exactly as in
CardLayout. Custom animations can be used as well, check the
DashboardCardLayout for an example.
Hope it can help someone. If you do some modifications, improvements,
please let me know, or put them in this list.
Best regards,
Luca Lutterotti
On Dec 13, 2004, at 18:57, Sam Berlin wrote:
JPanel panel = new JPanel();
AnimatingCardLayout layout = new AnimatingCardLayout();
layout.setAnimation(new MyAnimation()); // if someone wants to
provide their own animation
panel.setLayout(layout);
panel.add(comp1, "page1");
panel.add(comp2, "page2");
and then all someone has to do is call "layout.show(container,
"page1");" or layout.show(container, "page2");" and it would flip
between the cards using the animation
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Java-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/java-dev/email@hidden