Skip to content

Commit e1b7d71

Browse files
authored
Update readme with dialogs
1 parent 81f2cff commit e1b7d71

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

README.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,18 @@ MenuItem menuItem = new MenuItem("Select me");
8888
Observable<ActionEvent> menuItemEvents =
8989
JavaFxObservable.fromActionEvents(menuItem);
9090
```
91+
####Dialogs and Alerts
92+
```java
93+
Alert alert = new Alert(AlertType.CONFIRMATION);
94+
alert.setTitle("Confirmation");
95+
alert.setHeaderText("Please confirm your action");
96+
alert.setContentText("Are you ok with this?");
97+
9198

99+
JavaFxObservable.fromDialog(alert)
100+
.filter(response -> response.equals(ButtonType.OK))
101+
.subscribe(System.out::println,Throwable::printStackTrace);
102+
```
92103
###Other Event Factories
93104

94105
There are also factories provided to convert events from a `Window` as well as a `Scene` into an `Observable`. If you would like to see factories for other components and event types, please let us know or put in a PR.

0 commit comments

Comments
 (0)