Package ca.phon.ui.toast
Class Toast
java.lang.Object
ca.phon.ui.toast.Toast
A message to the user that is displayed in an un-decorated floating window. The window can be displayed for a certain amount of time and/or hidden when clicked.
To create a new toast, use ToastFactory
.
E.g.,
final Toast toast = ToastFactory.makeToast("Hello world!"); toast.setMessageBackground(Color.red); toast.setDisplayTime(2000); toast.start(comp);
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addToastListener
(ToastListener listener) Add a new toast listenervoid
void
displayNotification
(String title) void
displayNotification
(String title, String subtitle) Display message as a system notification.long
boolean
Is finished on clink?void
removeToastListener
(ToastListener listener) Remove a toast listenervoid
setDisplayTime
(long displayTime) Set the amount of time the toast is visible.void
setFinishOnClink
(boolean v) void
setMessage
(String message) Set messagevoid
Set background color of messagevoid
Foregroundvoid
start()
Start the toast displayed in the center of the screen.void
start
(JComponent comp) Start the tosast displayed under the given component.void
start
(JComponent comp, int x, int y) Start the toast displayed at the given screen coords for the given component.void
Start the toast display in the center of the frame.void
Start the toast display in the center of the window.
-
Method Details
-
isFinishOnClink
public boolean isFinishOnClink()Is finished on clink?- Returns:
- boolean
-
setFinishOnClink
public void setFinishOnClink(boolean v) -
setMessage
Set message- Parameters:
message
-
-
getMessage
-
setMessageBackground
Set background color of message- Parameters:
c
-
-
getMessageBackground
-
setMessageForeground
Foreground -
getMessageForeground
-
setDisplayTime
public void setDisplayTime(long displayTime) Set the amount of time the toast is visible.- Parameters:
displayTime
- display time in ms. A negative displayTime will leave the Toast shown until clicked or otherwise handled by the programmer
-
getDisplayTime
public long getDisplayTime() -
addToastListener
Add a new toast listener- Parameters:
listener
-
-
removeToastListener
Remove a toast listener- Parameters:
listener
-
-
start
public void start()Start the toast displayed in the center of the screen. -
start
Start the toast display in the center of the window.- Parameters:
window
-
-
start
Start the toast display in the center of the frame.- Parameters:
frame
-
-
start
Start the tosast displayed under the given component.- Parameters:
component
-
-
start
Start the toast displayed at the given screen coords for the given component.- Parameters:
comp
-x
-y
-
-
displayNotification
public void displayNotification() -
displayNotification
-
displayNotification
Display message as a system notification. On Mac OS X and Windows this will display a new system-level notification.- Parameters:
title
-subtitle
-
-