public class Notifications extends Object
NotificationPane which shows notification messages
within your application itself.
The following screenshot shows a sample notification rising from the
bottom-right corner of my screen:
To create the notification shown in the screenshot, simply do the following:
Notifications.create()
.title("Title Text")
.text("Hello World 0!")
.showWarning();
| Modifier and Type | Method and Description |
|---|---|
Notifications |
action(Action... actions)
Specify the actions that should be shown in the notification as buttons.
|
static Notifications |
create()
Call this to begin the process of building a notification to show.
|
Notifications |
darkStyle()
Specify that the notification should use the built-in dark styling,
rather than the default 'modena' notification style (which is a
light-gray).
|
Notifications |
graphic(Node graphic)
Specify the graphic to show in the notification.
|
Notifications |
hideAfter(Duration duration)
Specify the duration that the notification should show, after which it
will be hidden.
|
Notifications |
hideCloseButton()
Specify that the close button in the top-right corner of the notification
should not be shown.
|
Notifications |
onAction(EventHandler<ActionEvent> onAction)
Specify what to do when the user clicks on the notification (in addition
to the notification hiding, which happens whenever the notification is
clicked on).
|
Notifications |
owner(Object owner)
The dialog window owner - if specified the notifications will be inside
the owner, otherwise the notifications will be shown within the whole
screen.
|
Notifications |
position(Pos position)
Specify the position of the notification on screen, by default it is
bottom-right. |
void |
show()
Instructs the notification to be shown.
|
void |
showConfirm()
Instructs the notification to be shown, and that it should use the
built-in 'confirm' graphic.
|
void |
showError()
Instructs the notification to be shown, and that it should use the
built-in 'error' graphic.
|
void |
showInformation()
Instructs the notification to be shown, and that it should use the
built-in 'information' graphic.
|
void |
showWarning()
Instructs the notification to be shown, and that it should use the
built-in 'warning' graphic.
|
Notifications |
text(String text)
Specify the text to show in the notification.
|
Notifications |
title(String title)
Specify the title to show in the notification.
|
public static Notifications create()
public Notifications text(String text)
public Notifications title(String title)
public Notifications graphic(Node graphic)
public Notifications position(Pos position)
bottom-right.public Notifications owner(Object owner)
public Notifications hideAfter(Duration duration)
public Notifications onAction(EventHandler<ActionEvent> onAction)
public Notifications darkStyle()
public Notifications hideCloseButton()
public Notifications action(Action... actions)
public void showWarning()
public void showInformation()
public void showError()
public void showConfirm()
public void show()