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 intbuttonHGapGap between the text and the button, horizontallystatic intbuttonVGapGap between the text and the button, vertically.static ContainercntThe 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 intpaddingBottomPadding of the component.static intpaddingLeftPadding of the component.static intpaddingRightPadding of the component.static intpaddingTopPadding of the component.static 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, java.lang.String buttonCaption, int buttonForeColor, PressListener btnPressListener)Shows a toast message with a button 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.static voidshow(java.lang.String message, int delay, Window parentWindow, java.lang.String buttonCaption, int buttonForeColor, PressListener btnPressListener)Shows a toast message with a button using the given parameters on the given window.static voidstopShow()Unpop the Toast from the screen.static voidstopShow(boolean animate)Unpop the Toast from the screen.
-
-
-
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.
-
paddingLeft
public static int paddingLeft
Padding of the component.
-
paddingRight
public static int paddingRight
Padding of the component.
-
paddingTop
public static int paddingTop
Padding of the component.
-
paddingBottom
public static int paddingBottom
Padding of the component.
-
buttonHGap
public static int buttonHGap
Gap between the text and the button, horizontally
-
buttonVGap
public static int buttonVGap
Gap between the text and the button, vertically. Used when the button text is too big.
-
cnt
public static Container cnt
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, java.lang.String buttonCaption, int buttonForeColor, PressListener btnPressListener)Shows a toast message with a button using the given parameters on the given window.
-
show
public static void show(java.lang.String message, int delay, java.lang.String buttonCaption, int buttonForeColor, PressListener btnPressListener)Shows a toast message with a button using the given parameters on the main window.- See Also:
#show(String, int, Window, String, PressListener)
-
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 stopShow(). If delay is INFINITE_NOANIM, it will wait forever until you call stopShow() and will not use animation.
-
stopShow
public static void stopShow()
Unpop the Toast from the screen. If you don't want the animation of fading out, please call stopShow(false) instead.
-
stopShow
public static void stopShow(boolean animate)
Unpop the Toast from the screen.- Parameters:
animate- Animate the Toast with fading out.
-
-