Package totalcross.ui
Class Toast
- java.lang.Object
-
- totalcross.ui.Toast
-
public class Toast extends java.lang.ObjectClass used to show a message on screen.
-
-
Field Summary
Fields Modifier and Type Field Description static intbackColorBack color used in the toast.static ButtonbtnThe toast component used to show the text.static intextraWExtra width of the toast in font's height multiples.static intfadeThe stopping fade value, used on transparency.static FontfontThe font to be used.static intforeColorFore color used in the toast.static intheightHeight of the toast.static intINFINITEstatic intINFINITE_NOANIMstatic intposXX position of the toast.static intposYY position of the toast.static intwidthWidth of the toast.
-
Constructor Summary
Constructors Constructor Description Toast()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voidshow(java.lang.String message, int delay)Shows a toast message using the given parameters on the main window.static voidshow(java.lang.String message, int delay, Window parentWindow)Shows a toast message using the given parameters on the given window.
-
-
-
Field Detail
-
backColor
public static int backColor
Back color used in the toast.
-
foreColor
public static int foreColor
Fore color used in the toast.
-
posX
public static int posX
X position of the toast. Defaults to CENTER.
-
posY
public static int posY
Y position of the toast. Defaults to BOTTOM - fmH.
-
extraW
public static int extraW
Extra width of the toast in font's height multiples. Defaults to 2.
-
width
public static int width
Width of the toast. Defaults to PREFERRED.
-
height
public static int height
Height of the toast. Defaults to PREFERRED.
-
fade
public static int fade
The stopping fade value, used on transparency. Defaults to 200.
-
font
public static Font font
The font to be used. Defaults to the default bold font.
-
btn
public static Button btn
The toast component used to show the text.
-
INFINITE
public static final int INFINITE
- See Also:
- Constant Field Values
-
INFINITE_NOANIM
public static final int INFINITE_NOANIM
- See Also:
- Constant Field Values
-
-
Method Detail
-
show
public static void show(java.lang.String message, int delay)Shows a toast message using the given parameters on the main window.- See Also:
show(String, int, Window)
-
show
public static void show(java.lang.String message, int delay, Window parentWindow)Shows a toast message using the given parameters on the given window. Sample:String message = "This is a test"; Toast.show("\n"+message+"\n", 2000);See the public static fields of this class to show how you can customize the appearance. Calling with a nulled message will make the last toast disappear. The text is splitted if wider than the screen. If delay is INFINITE, it will wait forever until you call show(null,0). If delay is INFINITE_NOANIM, it will wait forever until you call show(null,0) and will not use animation.
-
-