Example usage for javafx.scene Scene setRoot

List of usage examples for javafx.scene Scene setRoot

Introduction

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

Prototype

public final void setRoot(Parent value) 

Source Link

Usage

From source file:Main.java

@Override
public void start(final Stage stage) {
    stage.setWidth(500);//w w  w.  j a va  2  s  .  c  o  m
    stage.setHeight(500);
    Scene scene = new Scene(new Group());

    VBox root = new VBox();
    CategoryAxis lineXAxis = new CategoryAxis(getData());

    ObservableList<String> list = lineXAxis.getCategories();

    root.getChildren().addAll(lineXAxis);
    scene.setRoot(root);

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

From source file:Main.java

@Override
public void start(final Stage stage) {
    stage.setWidth(500);/*w ww .  j av  a 2  s.c o  m*/
    stage.setHeight(500);
    Scene scene = new Scene(new Group());

    VBox root = new VBox();
    CategoryAxis lineXAxis = new CategoryAxis(getData());

    System.out.println(lineXAxis.getDisplayPosition("Sales"));

    root.getChildren().addAll(lineXAxis);
    scene.setRoot(root);

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

From source file:Main.java

@Override
public void start(final Stage stage) {
    stage.setTitle("HTML");
    stage.setWidth(500);/*from ww  w  .j  av  a  2 s  . c  om*/
    stage.setHeight(500);
    Scene scene = new Scene(new Group());

    VBox root = new VBox();

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

    root.getChildren().addAll(path);
    scene.setRoot(root);

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

From source file:Main.java

@Override
public void start(Stage stage) {
    Group root = new Group();
    Scene scene = new Scene(root, 260, 80);
    stage.setScene(scene);/* w  w  w. ja  va2  s .  c om*/

    Group g = new Group();

    Polygon polygon = new Polygon(0.0, 0.0, 20.0, 10.0, 10.0, 20.0);

    g.getChildren().add(polygon);

    System.out.println(polygon.getPoints());

    scene.setRoot(g);
    stage.show();
}

From source file:account.management.controller.ViewSalaryVoucherController.java

/**
 * Initializes the controller class./*  w  ww.  j  av a 2s .  c o  m*/
 */
@Override
public void initialize(URL url, ResourceBundle rb) {
    this.voucher_no.setCellValueFactory(new PropertyValueFactory("id"));
    this.date.setCellValueFactory(new PropertyValueFactory("date"));
    this.section.setCellValueFactory(new PropertyValueFactory("section"));
    this.name.setCellValueFactory(new PropertyValueFactory("name"));
    this.basis.setCellValueFactory(new PropertyValueFactory("basis"));
    this.amount.setCellValueFactory(new PropertyValueFactory("total"));

    final ContextMenu contextMenu = new ContextMenu();
    MenuItem item1 = new MenuItem("    View                  ");
    item1.setOnAction(new EventHandler<ActionEvent>() {
        public void handle(ActionEvent e) {
            Data.salaryVoucher = table.getSelectionModel().getSelectedItem();

            try {
                Parent root = FXMLLoader
                        .load(getClass().getResource(MetaData.viewPath + "EditSalaryVoucher.fxml"));
                Scene scene = new Scene(root);
                Stage stage = new Stage();
                scene.setRoot(root);
                stage.setResizable(false);
                stage.setTitle("Salary Voucher");
                stage.setScene(scene);
                stage.showAndWait();
                int index = table.getSelectionModel().getSelectedIndex();
                getData();

            } catch (IOException ex) {
                Logger.getLogger(ViewSalaryVoucherController.class.getName()).log(Level.SEVERE, null, ex);
            }

        }
    });
    contextMenu.getItems().addAll(item1);
    this.table.setContextMenu(contextMenu);

}

From source file:Main.java

@Override
public void start(Stage stage) {
    Group root = new Group();
    Scene scene = new Scene(root, 260, 80);
    stage.setScene(scene);/*from   w w w. jav  a  2  s .c o m*/

    Group g = new Group();

    Polygon polygon = new Polygon();
    polygon.getPoints().addAll(new Double[] { 0.0, 0.0, 20.0, 10.0, 10.0, 20.0 });

    g.getChildren().add(polygon);

    scene.setRoot(g);
    stage.show();
}

From source file:Main.java

@Override
public void start(Stage stage) {
    stage.setTitle("HTML");
    stage.setWidth(500);/*from   w  w w . j  ava  2s.  c o m*/
    stage.setHeight(500);
    Scene scene = new Scene(new Group());

    VBox root = new VBox();

    final HTMLEditor htmlEditor = new HTMLEditor();
    htmlEditor.setPrefHeight(600);
    htmlEditor.setHtmlText(INITIAL_TEXT);

    root.getChildren().addAll(htmlEditor);
    scene.setRoot(root);

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

From source file:Main.java

@Override
public void start(Stage stage) {
    Group root = new Group();
    Scene scene = new Scene(root, 260, 80);
    stage.setScene(scene);//  w ww  .ja v a 2 s . com

    Group g = new Group();

    Polyline polyline = new Polyline();
    polyline.getPoints().addAll(new Double[] { 0.0, 0.0, 20.0, 10.0, 10.0, 20.0 });

    g.getChildren().add(polyline);

    scene.setRoot(g);
    stage.show();
}

From source file:Main.java

@Override
public void start(Stage stage) {
    Group root = new Group();
    Scene scene = new Scene(root, 300, 150);
    stage.setScene(scene);// www .  j  ava  2  s. c om
    stage.setTitle("Text Field Sample");

    GridPane grid = new GridPane();
    grid.setPadding(new Insets(10, 10, 10, 10));
    grid.setVgap(5);
    grid.setHgap(5);

    scene.setRoot(grid);

    final TextField name = new TextField();
    name.setPromptText("Enter your first name.");
    name.setPrefColumnCount(10);
    name.getText();
    GridPane.setConstraints(name, 0, 0);
    grid.getChildren().add(name);

    stage.show();
}

From source file:Main.java

@Override
public void start(Stage stage) {
    Group root = new Group();
    Scene scene = new Scene(root, 600, 400);
    stage.setScene(scene);/*from  w w  w.  ja v  a 2  s .  c  om*/
    stage.setTitle("Slider Sample");

    GridPane grid = new GridPane();
    grid.setPadding(new Insets(10, 10, 10, 10));
    grid.setVgap(10);
    grid.setHgap(70);

    scene.setRoot(grid);

    GridPane.setConstraints(opacityCaption, 0, 1);
    grid.getChildren().add(opacityCaption);

    opacityLevel.valueProperty().addListener(new ChangeListener<Number>() {
        public void changed(ObservableValue<? extends Number> ov, Number old_val, Number new_val) {
            System.out.println(new_val.doubleValue());
            opacityValue.setText(String.format("%.2f", new_val));
        }
    });

    GridPane.setConstraints(opacityLevel, 1, 1);
    grid.getChildren().add(opacityLevel);

    GridPane.setConstraints(opacityValue, 2, 1);
    grid.getChildren().add(opacityValue);

    stage.show();
}