Example usage for javafx.scene.layout StackPane getChildren

List of usage examples for javafx.scene.layout StackPane getChildren

Introduction

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

Prototype

@Override
public ObservableList<Node> getChildren() 

Source Link

Usage

From source file:Main.java

@Override
public void start(Stage primaryStage) {
    NumberAxis xAxis = new NumberAxis();
    NumberAxis yAxis = new NumberAxis();
    xAxis.setAutoRanging(false);/*from  w  w w  .j a v a  2  s .  co m*/
    xAxis.setLowerBound(2011);
    xAxis.setUpperBound(2016);
    BubbleChart bubbleChart = new BubbleChart(xAxis, yAxis);
    bubbleChart.setData(getChartData());
    bubbleChart.setTitle("Title");
    primaryStage.setTitle("Chart example");

    StackPane root = new StackPane();
    root.getChildren().add(bubbleChart);
    primaryStage.setScene(new Scene(root, 400, 250));
    primaryStage.show();
}

From source file:net.sf.mzmine.chartbasics.gui.javafx.demo.FXCategoryChartGestureDemo.java

@Override
public void start(Stage stage) throws Exception {
    JFreeChart chart = ChartFactory.createBarChart("Random", "Category", "value", createDataset());
    EChartViewer canvas = new EChartViewer(chart);
    StackPane stackPane = new StackPane();
    stackPane.getChildren().add(canvas);
    stage.setScene(new Scene(stackPane));
    stage.setTitle("Chart gesture demo");
    stage.setWidth(700);/*  www. j  a  va  2s. c o  m*/
    stage.setHeight(390);
    stage.show();
}

From source file:net.sf.mzmine.chartbasics.gui.javafx.demo.FXChartGestureDemo.java

@Override
public void start(Stage stage) throws Exception {
    XYDataset dataset = createDataset();
    JFreeChart chart = ChartFactory.createXYLineChart("Random", "i", "r", createDataset());
    EChartViewer canvas = new EChartViewer(chart);
    StackPane stackPane = new StackPane();
    stackPane.getChildren().add(canvas);
    stage.setScene(new Scene(stackPane));
    stage.setTitle("Chart gesture demo");
    stage.setWidth(700);/*  ww w  . ja  v a 2  s . c  o  m*/
    stage.setHeight(390);
    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  www.  j a va  2s .  c om*/
    stage.setHeight(120);

    for (int i = 0; i < names.length; i++) {
        final CheckBox cb = cbs[i] = new CheckBox(names[i]);
        cb.selectedProperty().addListener(new ChangeListener<Boolean>() {
            public void changed(ObservableValue ov, Boolean old_val, Boolean new_val) {
                System.out.println(new_val);
            }
        });
    }

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

    HBox hbox = new HBox();
    hbox.setPadding(new Insets(0, 0, 0, 5));

    StackPane stack = new StackPane();
    stack.getChildren().add(hbox);

    HBox root = new HBox();
    root.getChildren().add(vbox);
    root.getChildren().add(stack);
    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(final Stage primaryStage) {
    StackPane sp = new StackPane();
    Button btnOpen = new Button("Open Dialog");
    sp.getChildren().add(btnOpen);

    btnOpen.setOnAction(new EventHandler<ActionEvent>() {
        public void handle(ActionEvent event) {
            Stage stage = new Stage();
            Scene page2 = new Scene(new Group(new Text(20, 20, "This is a new dialog!")));
            stage.setScene(page2);// w  w w. j a v  a  2  s .  co m
            stage.show();
        }
    });
    Scene scene = new Scene(sp, 300, 200);
    primaryStage.setScene(scene);
    primaryStage.show();
}

From source file:Main.java

@Override
public void start(Stage primaryStage) {
    primaryStage.setTitle("BorderPane Test");

    //Creating StackPane
    StackPane sp = new StackPane();

    ///* w  w  w.j a va 2 s  .c om*/
    Label lbl = new Label("JavaFX 2 StackPane");
    sp.getChildren().add(lbl);
    Button btn = new Button("Button");
    sp.getChildren().add(btn);

    //Adding StackPane to the scene
    Scene scene = new Scene(sp, 300, 200);
    primaryStage.setScene(scene);
    primaryStage.show();
}

From source file:Main.java

@Override
public void start(Stage stage) {
    Group group = new Group();
    Scene scene = new Scene(group);

    Label title = new Label("Label 1");
    StackPane stackpane = new StackPane();
    StackPane.setAlignment(title, Pos.BOTTOM_CENTER);
    stackpane.getChildren().addAll(new Label("Label"), title);

    group.getChildren().add(stackpane);/*from ww  w  .  ja v a2s . com*/

    stage.setTitle("Welcome to JavaFX!");
    stage.setScene(scene);
    stage.sizeToScene();
    stage.show();
}

From source file:Main.java

@Override
public void start(Stage primaryStage) {
    String workingDir = System.getProperty("user.dir");
    final File f = new File(workingDir, "../media/omgrobots.flv");

    final Media m = new Media(f.toURI().toString());
    final MediaPlayer mp = new MediaPlayer(m);
    final MediaView mv = new MediaView(mp);

    final DoubleProperty width = mv.fitWidthProperty();
    final DoubleProperty height = mv.fitHeightProperty();

    width.bind(Bindings.selectDouble(mv.sceneProperty(), "width"));
    height.bind(Bindings.selectDouble(mv.sceneProperty(), "height"));

    mv.setPreserveRatio(true);/*  www .j  a  v  a 2 s . c  om*/

    StackPane root = new StackPane();
    root.getChildren().add(mv);

    final Scene scene = new Scene(root, 960, 540);
    scene.setFill(Color.BLACK);

    primaryStage.setScene(scene);
    primaryStage.setTitle("Full Screen Video Player");
    primaryStage.setFullScreen(true);
    primaryStage.show();

    mp.play();
}

From source file:Main.java

@Override
public void start(Stage stage) {
    Group group = new Group();
    Scene scene = new Scene(group);

    StackPane stack = new StackPane();
    stack.setMaxSize(Region.USE_PREF_SIZE, Region.USE_PREF_SIZE);
    stack.getChildren().addAll(new Rectangle(100, 100, Color.BLUE));

    group.getChildren().add(stack);/*www .j  a  v  a2s  .  com*/

    stage.setTitle("Welcome to JavaFX!");
    stage.setScene(scene);
    stage.sizeToScene();
    stage.show();
}

From source file:gov.va.isaac.gui.util.ErrorMarkerUtils.java

/**
 * Setup an 'EXCLAMATION' error marker on the component. Automatically displays anytime that the reasonWhyControlInvalid value
 * is false. Hides when the isControlCurrentlyValid is true.
 * @param stackPane - optional - created if necessary
 *//*ww  w . j a v a2  s  .c  o m*/
public static StackPane setupErrorMarker(Node initialNode, StackPane stackPane,
        ValidBooleanBinding isNodeCurrentlyValid) {
    ImageView exclamation = Images.EXCLAMATION.createImageView();

    if (stackPane == null) {
        stackPane = new StackPane();
    }

    exclamation.visibleProperty().bind(isNodeCurrentlyValid.not());
    Tooltip tooltip = new Tooltip();
    tooltip.textProperty().bind(isNodeCurrentlyValid.getReasonWhyInvalid());
    Tooltip.install(exclamation, tooltip);
    tooltip.setAutoHide(true);

    exclamation.setOnMouseClicked(new EventHandler<MouseEvent>() {
        @Override
        public void handle(MouseEvent event) {
            tooltip.show(exclamation, event.getScreenX(), event.getScreenY());

        }

    });

    stackPane.setMaxWidth(Double.MAX_VALUE);
    stackPane.getChildren().add(initialNode);
    StackPane.setAlignment(initialNode, Pos.CENTER_LEFT);
    stackPane.getChildren().add(exclamation);
    StackPane.setAlignment(exclamation, Pos.CENTER_RIGHT);
    double insetFromRight;
    if (initialNode instanceof ComboBox) {
        insetFromRight = 30.0;
    } else if (initialNode instanceof ChoiceBox) {
        insetFromRight = 25.0;
    } else {
        insetFromRight = 5.0;
    }
    StackPane.setMargin(exclamation, new Insets(0.0, insetFromRight, 0.0, 0.0));
    return stackPane;
}