Client API. The Codename One framework your app is built on: this runs on the device, not in a backend.
public final class Confetti
- Object
- 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.
Methods
public static Confetti burst(Form form) | Shoots 120 pieces of confetti over a form. |
public static Confetti burst(Form form, int count) | Shoots confetti over a form. |
public int getParticleCount() | The number of pieces. |
public boolean isFinished() | True once the burst has ended and removed itself. |
public void stop() | Ends the burst at once. |
public boolean animate() | Allows the animation to reduce “repaint” calls when it returns false. |
public void paint(Graphics g) | Draws the animation, within a component the standard paint method would be invoked since it bares the exact same signature. |
public void paint(Graphics g, Rectangle rect) | Draws inside the given rectangle clipping area. |
Inherited methods
Method details
burst
public static Confetti burst(Form form)Shoots 120 pieces of confetti over a form.
Parameters
formForm- the form to cover
Returns
the burst, which removes itself when it ends
burst
public static Confetti burst(Form form, int count)Shoots confetti over a form.
Parameters
formForm- the form to cover
countint- the number of pieces
Returns
the burst, which removes itself when it ends
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()Allows 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.Display class.Returns
true if a repaint is desired or false if no repaint is necessary
paint
public void paint(Graphics g)Draws the animation, within a component the standard paint method would be
invoked since it bares the exact same signature.
Parameters
gGraphics- graphics context
paint
public void paint(Graphics g, Rectangle rect)Draws inside the given rectangle clipping area.
Parameters
gGraphics- the
Graphicsobject rectRectangle- the given rectangle cliping area