Example usage for javafx.scene Scene getRoot

List of usage examples for javafx.scene Scene getRoot

Introduction

In this page you can find the example usage for javafx.scene Scene getRoot.

Prototype

public final Parent getRoot() 

Source Link

Usage

From source file:Main.java

@Override
public void start(Stage stage) {
    Scene scene = new Scene(new Group(), 450, 250);
    ObservableList<String> list = FXCollections.observableArrayList("1", "2", "3", "4");
    ComboBox<String> emailComboBox = new ComboBox<String>(list);

    emailComboBox.setValue("A");
    System.out.println(emailComboBox.converterProperty());

    GridPane grid = new GridPane();
    grid.setVgap(4);// w w w.ja  v a  2s.  c  o m
    grid.setHgap(10);
    grid.setPadding(new Insets(5, 5, 5, 5));
    grid.add(new Label("To: "), 0, 0);
    grid.add(emailComboBox, 1, 0);

    Group root = (Group) scene.getRoot();
    root.getChildren().add(grid);
    stage.setScene(scene);
    stage.show();

}

From source file:Main.java

@Override
public void start(Stage stage) {
    Scene scene = new Scene(new Group(), 450, 250);
    ObservableList<String> list = FXCollections.observableArrayList("1", "2", "3", "4");
    ComboBox<String> emailComboBox = new ComboBox<String>(list);

    emailComboBox.setValue("A");
    System.out.println(emailComboBox.getVisibleRowCount());

    GridPane grid = new GridPane();
    grid.setVgap(4);//  w w  w .  j a v  a2  s .c  o m
    grid.setHgap(10);
    grid.setPadding(new Insets(5, 5, 5, 5));
    grid.add(new Label("To: "), 0, 0);
    grid.add(emailComboBox, 1, 0);

    Group root = (Group) scene.getRoot();
    root.getChildren().add(grid);
    stage.setScene(scene);
    stage.show();

}

From source file:Main.java

@Override
public void start(Stage stage) {
    Scene scene = new Scene(new Group(), 450, 250);
    ObservableList<String> list = FXCollections.observableArrayList("1", "2", "3", "4");
    ComboBox<String> emailComboBox = new ComboBox<String>(list);

    emailComboBox.setValue("A");
    System.out.println(emailComboBox.cellFactoryProperty());

    GridPane grid = new GridPane();
    grid.setVgap(4);/*from w w w  . j ava 2  s .c  om*/
    grid.setHgap(10);
    grid.setPadding(new Insets(5, 5, 5, 5));
    grid.add(new Label("To: "), 0, 0);
    grid.add(emailComboBox, 1, 0);

    Group root = (Group) scene.getRoot();
    root.getChildren().add(grid);
    stage.setScene(scene);
    stage.show();

}

From source file:com.tesshu.subsonic.client.sample4_music_andmovie.StreamPlayApplication.java

@Override
public void start(Stage stage) throws Exception {

    Search2Controller search2 = context.getBean(Search2Controller.class);

    StreamController streamController = context.getBean(StreamController.class);

    SuccessObserver callback = context.getBean(SuccessObserver.class);

    SearchResult2 result2 = search2.get("t", null, null, null, null, 1, null, null);

    Child song = result2.getSongs().get(0);

    final IRequestUriObserver uriCallBack = (subject, uri) -> {
        uriStr = uri.toString();//from  ww w.ja va  2  s.  co  m
    };

    streamController.stream(song, 128, // maxBitRate
            format, // format
            null, // timeOffset
            null, // size(Do not use it for video)
            true, // estimateContentLength
            null, // converted(Do not use it for video)
            null, // streamCallback
            uriCallBack, callback);

    Group root = new Group();
    Scene scene = new Scene(root, 640, 480);
    Media media = new Media(uriStr);
    media.errorProperty().addListener((observable, old, cur) -> {
        LOG.info(cur + " : " + uriStr);
    });

    MediaPlayer player = new MediaPlayer(media);
    player.statusProperty().addListener((observable, old, cur) -> {
        LOG.info(cur + " : " + uriStr);
    });

    MediaView view = new MediaView(player);
    ((Group) scene.getRoot()).getChildren().add(view);
    stage.setScene(scene);
    stage.show();
    player.play();

}

From source file:Main.java

@Override
public void start(Stage stage) {
    Scene scene = new Scene(new Group(), 450, 250);
    ObservableList<String> list = FXCollections.observableArrayList("1", "2", "3", "4");
    ComboBox<String> emailComboBox = new ComboBox<String>(list);

    emailComboBox.setValue("A");
    System.out.println(emailComboBox.selectionModelProperty());

    GridPane grid = new GridPane();
    grid.setVgap(4);//  ww  w. j  av a 2s.  c  o m
    grid.setHgap(10);
    grid.setPadding(new Insets(5, 5, 5, 5));
    grid.add(new Label("To: "), 0, 0);
    grid.add(emailComboBox, 1, 0);

    Group root = (Group) scene.getRoot();
    root.getChildren().add(grid);
    stage.setScene(scene);
    stage.show();

}

From source file:Main.java

@Override
public void start(Stage stage) {
    Scene scene = new Scene(new Group());
    stage.setTitle("Checkbox Sample");
    stage.setWidth(230);//from   ww  w .  j a  v  a  2s .  c  o m
    stage.setHeight(120);

    Path path = new Path();
    path.getElements().add(new MoveTo(0.0f, 50.0f));
    path.getElements().add(new LineTo(100.0f, 100.0f));

    VBox vbox = new VBox();
    vbox.getChildren().addAll(path);
    vbox.setSpacing(5);

    HBox root = new HBox();
    root.getChildren().add(vbox);
    root.setSpacing(40);
    root.setPadding(new Insets(20, 10, 10, 20));

    ((Group) scene.getRoot()).getChildren().add(root);

    stage.setScene(scene);
    stage.show();
}

From source file:Main.java

@Override
public void start(Stage stage) {
    Scene scene = new Scene(new Group(), 450, 250);
    ObservableList<String> list = FXCollections.observableArrayList("1", "2", "3", "4");
    ComboBox<String> emailComboBox = new ComboBox<String>(list);

    emailComboBox.setValue("A");
    System.out.println(emailComboBox.getSelectionModel().getSelectedIndex());

    GridPane grid = new GridPane();
    grid.setVgap(4);//  ww w .  ja va  2  s  .  c om
    grid.setHgap(10);
    grid.setPadding(new Insets(5, 5, 5, 5));
    grid.add(new Label("To: "), 0, 0);
    grid.add(emailComboBox, 1, 0);

    Group root = (Group) scene.getRoot();
    root.getChildren().add(grid);
    stage.setScene(scene);
    stage.show();

}

From source file:Main.java

@Override
public void start(Stage stage) {
    Scene scene = new Scene(new Group());
    stage.setWidth(300);/*ww  w  . j  a va  2s  .c  o m*/
    stage.setHeight(150);
    final CheckBox cb = new CheckBox();
    cb.setText("checkBox");
    final Tooltip tooltip = new Tooltip("$ tooltip");
    tooltip.setFont(new Font("Arial", 16));
    cb.setTooltip(tooltip);
    cb.selectedProperty().addListener(new ChangeListener<Boolean>() {
        public void changed(ObservableValue<? extends Boolean> ov, Boolean old_val, Boolean new_val) {
            System.out.println(cb.isSelected());
        }
    });

    ((Group) scene.getRoot()).getChildren().add(cb);

    stage.setScene(scene);
    stage.show();
}

From source file:Main.java

@Override
public void start(Stage stage) {
    Scene scene = new Scene(new Group(), 450, 250);
    ObservableList<String> list = FXCollections.observableArrayList("1", "2", "3", "4");
    ComboBox<String> emailComboBox = new ComboBox<String>();
    emailComboBox.setItems(list);//from  www . j a v  a2 s .  c o m
    emailComboBox.setValue("A");

    System.out.println(emailComboBox.visibleRowCountProperty());

    GridPane grid = new GridPane();
    grid.setVgap(4);
    grid.setHgap(10);
    grid.setPadding(new Insets(5, 5, 5, 5));
    grid.add(new Label("To: "), 0, 0);
    grid.add(emailComboBox, 1, 0);

    Group root = (Group) scene.getRoot();
    root.getChildren().add(grid);
    stage.setScene(scene);
    stage.show();

}

From source file:Main.java

@Override
public void start(Stage stage) {
    Scene scene = new Scene(new Group());
    stage.setTitle("Tooltip Sample");
    stage.setWidth(300);//w  w w.j  av a 2 s .com
    stage.setHeight(150);
    final CheckBox cb = new CheckBox("checkBox");
    final Tooltip tooltip = new Tooltip("$ tooltip");
    tooltip.setFont(new Font("Arial", 16));
    cb.setTooltip(tooltip);
    cb.selectedProperty().addListener(new ChangeListener<Boolean>() {
        public void changed(ObservableValue<? extends Boolean> ov, Boolean old_val, Boolean new_val) {
            System.out.println(cb.isSelected());
        }
    });

    ((Group) scene.getRoot()).getChildren().add(cb);

    stage.setScene(scene);
    stage.show();
}