Class Confetti
java.lang.Object
com.codename1.components.Confetti
A burst of confetti over the whole form, for celebrating a finished task.
Form form = new Form("Done", BoxLayout.y());
Button finish = new Button("Finish");
finish.addActionListener(e -> Confetti.burst(form));
form.add(finish);
form.show();
The pieces are painted in the form's glass pane, so they cover everything and take no touches. They shoot up from the bottom center, flutter down and are gone after about three seconds, when the glass pane the form had before is put back.
-
Method Summary
Modifier and TypeMethodDescriptionbooleananimate()Allows the animation to reduce "repaint" calls when it returns false.static ConfettiShoots 120 pieces of confetti over a form.static ConfettiShoots confetti over a form.intThe number of pieces.booleanTrue once the burst has ended and removed itself.voidDraws the animation, within a component the standard paint method would be invoked since it bares the exact same signature.voidDraws inside the given rectangle clipping area.voidstop()Ends the burst at once.
-
Method Details
-
burst
-
burst
-
getParticleCount
public int getParticleCount()The number of pieces. -
isFinished
public boolean isFinished()True once the burst has ended and removed itself. -
stop
public void stop()Ends the burst at once. -
animate
public boolean animate()Description copied from interface:AnimationAllows the animation to reduce "repaint" calls when it returns false. It is called once for every frame. Frames are defined by the
com.codename1.ui.Displayclass.Returns
true if a repaint is desired or false if no repaint is necessary
-
paint
-
paint
-