Java Reference
In-Depth Information
// add buttons
root.getChildren().add(buttonArea);
// create a close button
Node closeButton= createCloseButton(scene);
root.getChildren().add(closeButton);
primaryStage.setOnShown((WindowEvent we) -> {
previousLocation = new
Point2D(primaryStage.getX(), primaryStage.getY());
});
primaryStage.setScene(scene);
primaryStage.show();
}
Following is the attachMouseEvents() method, which adds an
EventHandler to the scene so the video player can enter full-screen mode.
private void attachMouseEvents(Scene scene, final Stage
primaryStage) {
// Full screen toggle
scene.setOnMouseClicked((MouseEvent event) -> {
if (event.getClickCount() == 2) {
primaryStage.setFullScreen(!primaryStage.isFullScreen());
}
});
... // the rest of the EventHandlers
}
The following method creates a slider control with a ChangeListener to enable
the users to search backward and forward through the video:
private Slider createSlider(Scene scene) {
Slider slider = new Slider();
slider.setMin(0);
slider.setMax(100);
Search WWH ::




Custom Search