Example usage for javafx.scene.layout Pane Pane

List of usage examples for javafx.scene.layout Pane Pane

Introduction

In this page you can find the example usage for javafx.scene.layout Pane Pane.

Prototype

public Pane(Node... children) 

Source Link

Document

Creates a Pane layout.

Usage

From source file:Main.java

@Override
public void start(Stage stage) {
    Text msg = new Text("java2s.com");
    msg.setTextOrigin(VPos.TOP);/*from w ww.j av  a 2s .co  m*/
    msg.setFont(Font.font(24));

    Pane root = new Pane(msg);
    root.setPrefSize(500, 70);
    Scene scene = new Scene(root);

    stage.setScene(scene);
    stage.setTitle("Scrolling Text");
    stage.show();

    double sceneWidth = scene.getWidth();
    double msgWidth = msg.getLayoutBounds().getWidth();

    KeyValue initKeyValue = new KeyValue(msg.translateXProperty(), sceneWidth);
    KeyFrame initFrame = new KeyFrame(Duration.ZERO, initKeyValue);

    KeyValue endKeyValue = new KeyValue(msg.translateXProperty(), -1.0 * msgWidth);
    KeyFrame endFrame = new KeyFrame(Duration.seconds(3), endKeyValue);

    Timeline timeline = new Timeline(initFrame, endFrame);

    timeline.setCycleCount(Timeline.INDEFINITE);
    timeline.play();
}

From source file:slideshow.client.ui.ClientUIController.java

/**
 * Set ImageView to fullscreen//from www.  ja v  a  2 s  .com
 * @param event
 */
@FXML
void fullscreenClicked(ActionEvent event) {
    System.out.println("slideshow.client.ui.ClientUIController.fullscreenClicked");
    Stage stage = new Stage();
    stage.setTitle("Fullscreen");

    ImageView iv = this.photoImageView;
    Pane p = new Pane(iv);

    Scene scene = new Scene(p);

    stage.setScene(scene);

    stage.setWidth(100);
    stage.setHeight(200);
    stage.setFullScreen(true);

    stage.show();

}