Example usage for javafx.scene.layout Pane getChildren

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

Introduction

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

Prototype

@Override
public ObservableList<Node> getChildren() 

Source Link

Usage

From source file:Main.java

public static Label createCustomLabel(String label, String cssClass, Pane parent) {
    Label l = new Label(label);
    l.getStyleClass().add(cssClass);//from   w  ww  .  j a  va2 s  .c  o m
    parent.getChildren().add(l);
    return l;
}

From source file:Main.java

public static Label createLabel(String label, String cssClass, Pane parent) {
    Label l = new Label(label);
    l.getStyleClass().add("label-defaults");
    l.getStyleClass().add(cssClass);/*from  www . ja  v a2s .  c om*/
    parent.getChildren().add(l);
    return l;
}

From source file:Main.java

public static void startValueSetAnimation(final Pane parent) {
    final javafx.scene.shape.Rectangle rectangle = new javafx.scene.shape.Rectangle();
    Insets margin = BorderPane.getMargin(parent);
    if (margin == null) {
        margin = new Insets(0);
    }/*from   w w  w  . ja  v a  2 s  .  c om*/
    rectangle.widthProperty().bind(parent.widthProperty().subtract(margin.getLeft() + margin.getRight()));
    rectangle.heightProperty().bind(parent.heightProperty().subtract(margin.getTop() + margin.getBottom()));
    rectangle.setFill(Color.rgb(0, 150, 201));
    parent.getChildren().add(rectangle);

    BoxBlur bb = new BoxBlur();
    bb.setWidth(5);
    bb.setHeight(5);
    bb.setIterations(3);
    rectangle.setEffect(bb);

    FadeTransition ft = new FadeTransition(Duration.millis(250), rectangle);
    ft.setFromValue(0.2);
    ft.setToValue(0.8);
    ft.setCycleCount(2);
    ft.setAutoReverse(true);
    ft.play();
    ft.setOnFinished(new EventHandler<ActionEvent>() {
        @Override
        public void handle(ActionEvent event) {
            parent.getChildren().remove(rectangle);
        }
    });
}

From source file:Main.java

@Override
public void start(Stage stage) {
    Canvas canvas = new Canvas(300, 100);

    GraphicsContext gc = canvas.getGraphicsContext2D();

    gc.setLineWidth(2.0);//from  ww w.ja  v  a 2s.  c  o  m
    gc.setFill(Color.RED);

    gc.strokeRoundRect(10, 10, 50, 50, 10, 10);

    gc.fillOval(70, 10, 50, 20);

    gc.strokeText("Hello Canvas", 150, 20);

    Pane root = new Pane();
    root.getChildren().add(canvas);
    Scene scene = new Scene(root);
    stage.setScene(scene);
    stage.setTitle("");
    stage.show();
}

From source file:eu.mihosoft.vfxwebkit.DemoApplication.java

@Override
public void start(Stage primaryStage) {
    Path tmpFile = null;//from w ww.  j  a v  a 2s.  co  m
    try {
        tmpFile = Files.createTempDirectory("eu.mihosoft.vfxwebkit");
    } catch (IOException ex) {
        Logger.getLogger(DemoApplication.class.getName()).log(Level.SEVERE, null, ex);
        System.exit(1);
    }

    try {
        FileUtils.copyDirectory(new File("src/main/resources/eu/mihosoft/vfxwebkit/"), tmpFile.toFile());
        //            FileUtils.copyDirectory(
        //                    new File("/Users/miho/Qt/qt/5.5/clang_64/lib/"),
        //                    new File(tmpFile.toFile(),"native/osx/"));
    } catch (IOException ex) {
        Logger.getLogger(DemoApplication.class.getName()).log(Level.SEVERE, null, ex);
    }

    File libraryPath = new File(tmpFile.toFile(), "native/osx/libvfxwebkit.1.0.0.dylib");

    System.load(libraryPath.getAbsolutePath());

    //        new Thread(()->{NativeBinding.INSTANCE.init();}).start();

    //        NativeBinding.INSTANCE.init();

    VFXWebNode webView = VFXWebNode.newInstance(VFXWebNode.NodeType.JFX_DIRECT_BUFFER);
    //        webView.getEngine().load("http://learningwebgl.com/lessons/lesson04/index.html");

    Window w = new Window("Qt WebKit & WebGL inside JavaFX");
    w.setPrefSize(600, 440);

    w.getContentPane().getChildren().add(webView.getNode());

    //        Window w2 = new Window("JavaFX WebView");
    //        w2.setLayoutX(620);
    //        w2.setPrefSize(600, 440);
    //        
    //        WebView fxview = new WebView();
    //        fxview.getEngine().load("http://learningwebgl.com/lessons/lesson04/index.html");
    //        
    //        w2.getContentPane().getChildren().add(fxview);

    Pane root = new Pane();
    root.getChildren().add(w);

    Scene scene = new Scene(root, 1280, 1024);

    primaryStage.setTitle("Hello Native Qt, hello WebGL!");
    primaryStage.setScene(scene);
    primaryStage.show();
}

From source file:org.pdfsam.ui.dashboard.about.AboutDashboardPane.java

private void addSectionTitle(String title, Pane pane) {
    Label label = new Label(title);
    label.getStyleClass().add("section-title");
    pane.getChildren().add(label);
}

From source file:Main.java

@Override
public void start(final Stage stage) {
    final Node loginPanel = makeDraggable(createLoginPanel());
    final Node confirmationPanel = makeDraggable(createConfirmationPanel());
    final Node progressPanel = makeDraggable(createProgressPanel());

    loginPanel.relocate(0, 0);/*ww w . j a  v  a 2s .c o  m*/
    confirmationPanel.relocate(0, 67);
    progressPanel.relocate(0, 106);

    final Pane panelsPane = new Pane();
    panelsPane.getChildren().addAll(loginPanel, confirmationPanel, progressPanel);

    final BorderPane sceneRoot = new BorderPane();

    BorderPane.setAlignment(panelsPane, Pos.TOP_LEFT);
    sceneRoot.setCenter(panelsPane);

    final CheckBox dragModeCheckbox = new CheckBox("Drag mode");
    BorderPane.setMargin(dragModeCheckbox, new Insets(6));
    sceneRoot.setBottom(dragModeCheckbox);

    dragModeActiveProperty.bind(dragModeCheckbox.selectedProperty());

    final Scene scene = new Scene(sceneRoot, 400, 300);
    stage.setScene(scene);
    stage.setTitle("Draggable Panels Example");
    stage.show();
}

From source file:de.unibw.inf2.fishification.buttons.ButtonManager.java

private void clearRemovePane(Pane pane) {
    pane.getChildren().clear();
    m_fishWorld.removeNode(pane);
}

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);/*  ww w .j ava  2  s . co  m*/
    stage.setTitle("");

    VBox vb = new VBox();

    Pane canvas = new Pane();
    canvas.setStyle("-fx-background-color: black;");
    canvas.setPrefSize(200, 200);
    Circle circle = new Circle(50, Color.BLUE);
    circle.relocate(20, 20);
    Rectangle rectangle = new Rectangle(100, 100, Color.RED);
    rectangle.relocate(70, 70);
    canvas.getChildren().addAll(circle, rectangle);

    vb.getChildren().add(canvas);

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

From source file:com.github.drbookings.ui.controller.BookingDetailsController.java

private static void addRow4(final Pane content, final BookingBean be) {
    final HBox box = new HBox();
    box.setPadding(new Insets(4));
    box.setAlignment(Pos.CENTER_LEFT);//from  w w w.  j  a va2  s . com
    box.setFillHeight(true);
    final TextFlow tf = new TextFlow();
    final Text t0 = new Text("Net Earnings: \t");
    final Text netEarnings = new Text(String.format("%3.2f", be.getNetEarnings()));
    final Text t1 = new Text(" total \t");
    final Text netEarningsDay = new Text(String.format("%3.2f", be.getNetEarnings() / be.getNumberOfNights()));
    final Text t2 = new Text(" /night");
    tf.getChildren().addAll(t0, netEarnings, t1, netEarningsDay, t2);
    box.getChildren().addAll(tf);
    if (be.getNetEarnings() <= 0) {
        box.getStyleClass().addAll("warning", "warning-bg");
    }
    content.getChildren().add(box);

}