You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+52-9Lines changed: 52 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -61,13 +61,54 @@ RxJavaFX has a lightweight set of features:
61
61
62
62
###Node Events
63
63
You can get event emissions by calling `JavaFxObservable.fromNodeEvents()` and pass the JavaFX `Node` and the `EventType` you are interested in. This will return an RxJava `Observable`.
Action events are common and do not only apply to `Node` types. They also emit from `MenuItem` and `ContextMenu` instances, as well as a few other types.
74
+
75
+
Therefore, a few overloaded factories are provided to emit `ActionEvent` items from these controls
76
+
77
+
#####Button ActionEvents
78
+
```java
79
+
Button incrementBttn =newButton("Increment");
80
+
81
+
Observable<ActionEvent> bttnEvents =
82
+
JavaFxObservable.fromActionEvents(incrementBttn);
83
+
```
84
+
#####MenuItem ActionEvents
85
+
```java
86
+
MenuItem menuItem =newMenuItem("Select me");
87
+
88
+
Observable<ActionEvent> menuItemEvents =
89
+
JavaFxObservable.fromActionEvents(menuItem);
90
+
```
91
+
92
+
###Other Event Factories
93
+
94
+
There are also factories provided to convert events from a `Window` as well as a `Scene` into an `Observable`.
Not to be confused with the RxJava `Observable`, the JavaFX `ObservableValue` can be converted into an RxJava `Observable` that emits the initial value and all value changes.
@@ -170,9 +211,9 @@ import javafx.scene.Scene;
170
211
importjavafx.scene.control.*;
171
212
importjavafx.scene.layout.GridPane;
172
213
importjavafx.stage.Stage;
214
+
importrx.Observable;
215
+
importrx.Subscription;
173
216
importrx.observables.JavaFxObservable;
174
-
importrx.schedulers.JavaFxScheduler;
175
-
importrx.schedulers.Schedulers;
176
217
importrx.subscribers.JavaFxSubscriber;
177
218
178
219
publicclassRxJavaFXTestextendsApplication {
@@ -182,7 +223,7 @@ public class RxJavaFXTest extends Application {
182
223
privatefinalBinding<String> binding1;
183
224
184
225
privatefinalTextField textInput;
185
-
privatefinalLabelfippedTextLabel;
226
+
privatefinalLabelflippedTextLabel;
186
227
privatefinalBinding<String> binding2;
187
228
188
229
privatefinalSpinner<Integer> spinner;
@@ -191,13 +232,13 @@ public class RxJavaFXTest extends Application {
0 commit comments