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();
When there are too many notifications on the screen, one can opt to collapse
the notifications into a single notification using Notifications#threshold(int, Notifications).
Notifications.create()
.title("Title Text")
.text("Hello World 0!")
.threshold(3, Notifications.create().title("Collapsed Notification"))
.showWarning();
| Modifier and Type | Class and Description |
|---|---|
| private static class | Notifications.
Private support classes * * |
| Modifier and Type | Field and Description |
|---|---|
| private ObservableList | |
| private Node | |
| private Duration | |
| private boolean | |
| private EventHandler | |
| private Window | |
| private Pos | |
| private Screen | |
| private static final String | STYLE_CLASS_DARK
Static fields * * |
| private List | |
| private String | |
| private int | |
| private Notifications | |
| private String | title
Private fields * * |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| public Notifications | |
| public static Notifications | |
| public Notifications | darkStyle()
Specifies that the notification should use the built-in dark styling, rather than the default 'modena' notification style (which is a light-gray). |
| public List | |
| public Notifications | |
| public Notifications | |
| public Notifications | hideCloseButton()
Specifies that the close button in the top-right corner of the notification should not be shown. |
| public Notifications | onAction(EventHandler<ActionEvent> onAction)
Specifies what to do when the user clicks on the notification (in addition to the notification hiding, which happens whenever the notification is clicked on). |
| public Notifications | |
| public Notifications | position(Pos position)
Specifies the position of the notification on screen, by default it is
|
| public void | |
| public void | showConfirm()
Instructs the notification to be shown, and that it should use the built-in 'confirm' graphic. |
| public void | showError()
Instructs the notification to be shown, and that it should use the built-in 'error' graphic. |
| public void | showInformation()
Instructs the notification to be shown, and that it should use the built-in 'information' graphic. |
| public void | showWarning()
Instructs the notification to be shown, and that it should use the built-in 'warning' graphic. |
| public Notifications | |
| public Notifications | |
| public Notifications | threshold(int
The number of notifications to show before they can be collapsed
into a single notification. threshold, Notifications The thresholdNotification)notification to show when
threshold is reached.Collapses all the current notifications into a single notification when the number of notifications exceed the threshold limit. |
| public Notifications |
| actions | back to summary |
|---|---|
| private ObservableList<Action> actions | |
| graphic | back to summary |
|---|---|
| private Node graphic | |
| hideAfterDuration | back to summary |
|---|---|
| private Duration hideAfterDuration | |
| hideCloseButton | back to summary |
|---|---|
| private boolean hideCloseButton | |
| onAction | back to summary |
|---|---|
| private EventHandler<ActionEvent> onAction | |
| owner | back to summary |
|---|---|
| private Window owner | |
| position | back to summary |
|---|---|
| private Pos position | |
| screen | back to summary |
|---|---|
| private Screen screen | |
| STYLE_CLASS_DARK | back to summary |
|---|---|
| private static final String STYLE_CLASS_DARK Static fields * * | |
| styleClass | back to summary |
|---|---|
| private List<String> styleClass | |
| text | back to summary |
|---|---|
| private String text | |
| threshold | back to summary |
|---|---|
| private int threshold | |
| thresholdNotification | back to summary |
|---|---|
| private Notifications thresholdNotification | |
| title | back to summary |
|---|---|
| private String title Private fields * * | |
| Notifications | back to summary |
|---|---|
| private Notifications() Constructors * * | |
| action | back to summary |
|---|---|
| public Notifications action(Action... actions) Specifies the actions that should be shown in the notification as buttons. | |
| create | back to summary |
|---|---|
| public static Notifications create() Call this to begin the process of building a notification to show. | |
| darkStyle | back to summary |
|---|---|
| public Notifications darkStyle() Specifies that the notification should use the built-in dark styling, rather than the default 'modena' notification style (which is a light-gray). | |
| getStyleClass | back to summary |
|---|---|
| public List Gets the style classes that would be added to the | |
| graphic | back to summary |
|---|---|
| public Notifications graphic(Node graphic) Specifies the graphic to show in the notification. | |
| hideAfter | back to summary |
|---|---|
| public Notifications hideAfter(Duration duration) Specifies the duration that the notification should show, after which it will be hidden. | |
| hideCloseButton | back to summary |
|---|---|
| public Notifications hideCloseButton() Specifies that the close button in the top-right corner of the notification should not be shown. | |
| onAction | back to summary |
|---|---|
| public Notifications onAction(EventHandler<ActionEvent> onAction) Specifies what to do when the user clicks on the notification (in addition to the notification hiding, which happens whenever the notification is clicked on). | |
| owner | back to summary |
|---|---|
| public Notifications owner(Object owner) The dialog window owner - which can be | |
| position | back to summary |
|---|---|
| public Notifications position(Pos position) Specifies the position of the notification on screen, by default it is
| |
| show | back to summary |
|---|---|
| public void show() Instructs the notification to be shown. | |
| showConfirm | back to summary |
|---|---|
| public void showConfirm() Instructs the notification to be shown, and that it should use the built-in 'confirm' graphic. | |
| showError | back to summary |
|---|---|
| public void showError() Instructs the notification to be shown, and that it should use the built-in 'error' graphic. | |
| showInformation | back to summary |
|---|---|
| public void showInformation() Instructs the notification to be shown, and that it should use the built-in 'information' graphic. | |
| showWarning | back to summary |
|---|---|
| public void showWarning() Instructs the notification to be shown, and that it should use the built-in 'warning' graphic. | |
| styleClass | back to summary |
|---|---|
| public Notifications styleClass(String... styleClasses) Specifies the style classes to add to the | |
| text | back to summary |
|---|---|
| public Notifications text(String text) Specifies the text to show in the notification. | |
| threshold | back to summary |
|---|---|
| public Notifications threshold(int threshold, Notifications thresholdNotification) Collapses all the current notifications into a single notification when the number of notifications exceed the threshold limit. A value of zero will disable the threshold behavior.
| |
| title | back to summary |
|---|---|
| public Notifications title(String title) Specifies the title to show in the notification. | |
| Modifier and Type | Class and Description |
|---|---|
| pack-priv class |
| Modifier and Type | Field and Description |
|---|---|
| private static final String | |
| private static final Notifications. | |
| private boolean | |
| private static final double | |
| private ParallelTransition | |
| private final Map | |
| private double | |
| private double | |
| private static final double | |
| private double | |
| private double |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| private void | |
| private Timeline | |
| private void | |
| private double | |
| pack-priv static final Notifications. | |
| private Optional | |
| private void | |
| private boolean | |
| private void | |
| private void | |
| public void | |
| private void |
| FINAL_ANCHOR_Y | back to summary |
|---|---|
| private static final String FINAL_ANCHOR_Y | |
| INSTANCE | back to summary |
|---|---|
| private static final Notifications. | |
| isShowing | back to summary |
|---|---|
| private boolean isShowing | |
| PADDING | back to summary |
|---|---|
| private static final double PADDING | |
| parallelTransition | back to summary |
|---|---|
| private ParallelTransition parallelTransition | |
| popupsMap | back to summary |
|---|---|
| private final Map<Pos, List<Popup>> popupsMap | |
| screenHeight | back to summary |
|---|---|
| private double screenHeight | |
| screenWidth | back to summary |
|---|---|
| private double screenWidth | |
| SPACING | back to summary |
|---|---|
| private static final double SPACING | |
| startX | back to summary |
|---|---|
| private double startX | |
| startY | back to summary |
|---|---|
| private double startY | |
| NotificationPopupHandler | back to summary |
|---|---|
| private NotificationPopupHandler() | |
| addPopupToMap | back to summary |
|---|---|
| private void addPopupToMap(Pos p, Popup popup) | |
| createHideTimeline | back to summary |
|---|---|
| private Timeline createHideTimeline(final Popup popup, NotificationBar bar, final Pos p, Duration startDelay) | |
| doAnimation | back to summary |
|---|---|
| private void doAnimation(Pos p, Popup changedPopup) | |
| getFinalAnchorY | back to summary |
|---|---|
| private double getFinalAnchorY(Popup popup) | |
| getInstance | back to summary |
|---|---|
| pack-priv static final Notifications. | |
| getScreenBounds | back to summary |
|---|---|
| private Optional | |
| hide | back to summary |
|---|---|
| private void hide(Popup popup, Pos p) | |
| isShowFromTop | back to summary |
|---|---|
| private boolean isShowFromTop(Pos p) | |
| removePopupFromMap | back to summary |
|---|---|
| private void removePopupFromMap(Pos p, Popup popup) | |
| setFinalAnchorY | back to summary |
|---|---|
| private void setFinalAnchorY(Popup popup, double anchorY) | |
| show | back to summary |
|---|---|
| public void show(Notifications notification) | |
| show | back to summary |
|---|---|
| private void show(Window owner, final Notifications notification) | |
| Modifier and Type | Field and Description |
|---|---|
| private double | |
| private double | |
| private WeakReference |
| Access | Constructor and Description |
|---|---|
| pack-priv |
| Modifier and Type | Method and Description |
|---|---|
| protected void | interpolate(double frac)
Implements abstract javafx. The method |
| distance | back to summary |
|---|---|
| private double distance | |
| oldAnchorY | back to summary |
|---|---|
| private double oldAnchorY | |
| popupWeakReference | back to summary |
|---|---|
| private WeakReference<Popup> popupWeakReference | |
| CustomTransition | back to summary |
|---|---|
| pack-priv CustomTransition(Popup popup, double oldAnchorY, double distance) | |
| interpolate | back to summary |
|---|---|
| protected void interpolate(double frac) Implements abstract javafx. Doc from javafx. The method
| |