Example usage for javafx.scene.layout VBox getChildren

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

Introduction

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

Prototype

@Override
public ObservableList<Node> getChildren() 

Source Link

Usage

From source file:org.pdfsam.rotate.RotateModule.java

@Override
protected Pane getInnerPanel() {
    VBox pane = new VBox();
    pane.setAlignment(Pos.TOP_CENTER);//from   ww  w . ja va2s . com
    VBox.setVgrow(selectionPane, Priority.ALWAYS);

    TitledPane prefixTitled = Views.titledPane(DefaultI18nContext.getInstance().i18n("File names settings"),
            prefix);
    prefix.addMenuItemFor(Prefix.FILENUMBER);

    TitledPane options = Views.titledPane(DefaultI18nContext.getInstance().i18n("Rotate settings"),
            rotateOptions);

    pane.getChildren().addAll(selectionPane, options,
            Views.titledPane(DefaultI18nContext.getInstance().i18n("Destination directory"), destinationPane),
            prefixTitled);
    return pane;
}

From source file:Main.java

@Override
public void start(Stage stage) {
    VBox root = new VBox(5);

    Label textLbl = new Label("Text:");
    TextArea text = new TextArea();
    text.setPrefRowCount(10);/*from  ww  w  . ja  va  2  s .  co m*/
    text.setPrefColumnCount(20);
    text.setWrapText(true);

    // Button to print the TextArea node
    Button printTextBtn = new Button("Print Text");
    printTextBtn.setOnAction(e -> print(text));

    // Button to print the entire scene
    Button printSceneBtn = new Button("Print Scene");
    printSceneBtn.setOnAction(e -> print(root));

    HBox buttonBox = new HBox(5, printTextBtn, printSceneBtn);

    root.getChildren().addAll(textLbl, text, buttonBox);
    Scene scene = new Scene(root);
    stage.setScene(scene);
    stage.setTitle("Printing Nodes");
    stage.show();
}

From source file:Main.java

@Override
public void start(Stage stage) {
    Scene scene = new Scene(new Group());
    stage.setTitle("Button Sample");
    stage.setWidth(300);/*from   ww w.ja  va 2  s . c  o  m*/
    stage.setHeight(190);

    VBox vbox = new VBox();
    vbox.setLayoutX(20);
    vbox.setLayoutY(20);

    final Button button1 = new Button("Accept");

    button1.addEventHandler(MouseEvent.MOUSE_ENTERED, new EventHandler<MouseEvent>() {
        @Override
        public void handle(MouseEvent e) {
            button1.setEffect(shadow);
        }
    });

    button1.addEventHandler(MouseEvent.MOUSE_EXITED, new EventHandler<MouseEvent>() {
        @Override
        public void handle(MouseEvent e) {
            button1.setEffect(null);
        }
    });

    vbox.getChildren().add(button1);
    vbox.setSpacing(10);
    ((Group) scene.getRoot()).getChildren().add(vbox);

    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);/*from  w w w  . j  a v a  2  s . com*/
    stage.setHeight(190);

    VBox vbox = new VBox();
    vbox.setLayoutX(20);
    vbox.setLayoutY(20);

    final Button button1 = new Button("OK");

    button1.addEventHandler(MouseEvent.MOUSE_ENTERED, new EventHandler<MouseEvent>() {
        @Override
        public void handle(MouseEvent e) {
            System.out.println("mouse entered");
        }
    });

    button1.addEventHandler(MouseEvent.MOUSE_EXITED, new EventHandler<MouseEvent>() {
        @Override
        public void handle(MouseEvent e) {
            System.out.println("mouse out");
        }
    });

    vbox.getChildren().add(button1);
    ((Group) scene.getRoot()).getChildren().add(vbox);

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

From source file:Main.java

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

    VBox vbox = new VBox();
    vbox.setLayoutX(20);
    vbox.setLayoutY(20);

    final String content = "Lorem ipsum";
    final Text text = new Text(10, 20, "");

    final Animation animation = new Transition() {
        {
            setCycleDuration(Duration.millis(2000));
        }

        protected void interpolate(double frac) {
            final int length = content.length();
            final int n = Math.round(length * (float) frac);
            text.setText(content.substring(0, n));
        }

    };
    animation.play();

    vbox.getChildren().add(text);
    vbox.setSpacing(10);
    ((Group) scene.getRoot()).getChildren().add(vbox);

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

From source file:Main.java

@Override
public void start(Stage stage) {
    Scene scene = new Scene(new Group());
    stage.setTitle("Sample");
    stage.setWidth(300);/* w w  w .j  a va2s .c om*/
    stage.setHeight(190);

    VBox vbox = new VBox();
    vbox.setLayoutX(20);
    vbox.setLayoutY(20);

    final String content = "Lorem ipsum";
    final Text text = new Text(10, 20, "");

    final Animation animation = new Transition() {
        {
            setCycleDuration(Duration.millis(2000));
        }

        protected void interpolate(double frac) {
            final int length = content.length();
            final int n = Math.round(length * (float) frac);
            text.setText(content.substring(0, n));
        }

    };

    animation.play();

    vbox.getChildren().add(text);
    vbox.setSpacing(10);
    ((Group) scene.getRoot()).getChildren().add(vbox);

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

From source file:org.jevis.jeconfig.JEConfig.java

/**
 * Build an new JEConfig Login and main frame/stage
 *
 * @param primaryStage//ww w.  j  a v a2  s . c  om
 */
//AITBilal - Login  
private void initGUI(Stage primaryStage) {
    Scene scene;
    LoginGlass login = new LoginGlass(primaryStage);

    AnchorPane jeconfigRoot = new AnchorPane();
    AnchorPane.setTopAnchor(jeconfigRoot, 0.0);
    AnchorPane.setRightAnchor(jeconfigRoot, 0.0);
    AnchorPane.setLeftAnchor(jeconfigRoot, 0.0);
    AnchorPane.setBottomAnchor(jeconfigRoot, 0.0);
    //        jeconfigRoot.setStyle("-fx-background-color: white;");
    //        jeconfigRoot.getChildren().setAll(new Label("sodfhsdhdsofhdshdsfdshfjf"));

    Screen screen = Screen.getPrimary();
    Rectangle2D bounds = screen.getVisualBounds();

    // @AITBilal - Main frame elemente wird aufgerufen nachdem man sich eingeloggt hat.
    login.getLoginStatus().addListener(new ChangeListener<Boolean>() {

        @Override
        public void changed(ObservableValue<? extends Boolean> observable, Boolean oldValue, Boolean newValue) {
            if (newValue) {
                System.out.println("after request");
                _mainDS = login.getDataSource();
                ds = _mainDS;

                Platform.runLater(new Runnable() {
                    @Override
                    public void run() {
                        FadeTransition ft = new FadeTransition(Duration.millis(1500), login);
                        ft.setFromValue(1.0);
                        ft.setToValue(0);
                        ft.setCycleCount(1);
                        ft.play();
                    }
                });

                JEConfig.PROGRAMM_INFO.setJEVisAPI(ds.getInfo());
                JEConfig.PROGRAMM_INFO.addLibrary(org.jevis.commons.application.Info.INFO);
                JEConfig.PROGRAMM_INFO.addLibrary(org.jevis.application.Info.INFO);

                preLodedClasses = login.getAllClasses();
                preLodedRootObjects = login.getRootObjects();

                PluginManager pMan = new PluginManager(ds);
                //@AITBilal - Toolbar fr save, newB, delete, sep1, form
                GlobalToolBar toolbar = new GlobalToolBar(pMan);
                pMan.addPluginsByUserSetting(null);

                //                    StackPane root = new StackPane();
                //                    root.setId("mainpane");
                BorderPane border = new BorderPane();
                VBox vbox = new VBox();
                vbox.getChildren().addAll(new TopMenu(), toolbar.ToolBarFactory());
                border.setTop(vbox);
                //@AITBilal - Alle Plugins Inhalt fr JEConfig (Resources... | System | Attribute)
                border.setCenter(pMan.getView());

                Statusbar statusBar = new Statusbar(ds);

                border.setBottom(statusBar);

                System.out.println("show welcome");

                //Disable GUI is StatusBar note an disconnect
                border.disableProperty().bind(statusBar.connectedProperty.not());

                Platform.runLater(new Runnable() {
                    @Override
                    public void run() {
                        AnchorPane.setTopAnchor(border, 0.0);
                        AnchorPane.setRightAnchor(border, 0.0);
                        AnchorPane.setLeftAnchor(border, 0.0);
                        AnchorPane.setBottomAnchor(border, 0.0);

                        jeconfigRoot.getChildren().setAll(border);
                        //                            try {
                        //            WelcomePage welcome = new WelcomePage(primaryStage, new URI("http://coffee-project.eu/"));
                        //            WelcomePage welcome = new WelcomePage(primaryStage, new URI("http://openjevis.org/projects/openjevis/wiki/JEConfig3#JEConfig-Version-3"));

                        //                            Task<Void> showWelcome = new Task<Void>() {
                        //                                @Override
                        //                                protected Void call() throws Exception {
                        try {
                            WelcomePage welcome = new WelcomePage(primaryStage, _config.getWelcomeURL());
                        } catch (URISyntaxException ex) {
                            Logger.getLogger(JEConfig.class.getName()).log(Level.SEVERE, null, ex);
                        } catch (MalformedURLException ex) {
                            Logger.getLogger(JEConfig.class.getName()).log(Level.SEVERE, null, ex);
                        }
                        //                                    return null;
                        //                                }
                        //                            };
                        //                            new Thread(showWelcome).start();

                        //                                WelcomePage welcome = new WelcomePage(primaryStage, _config.getWelcomeURL());
                        //                            } catch (URISyntaxException ex) {
                        //                                Logger.getLogger(JEConfig.class.getName()).log(Level.SEVERE, null, ex);
                        //                            } catch (MalformedURLException ex) {
                        //                                Logger.getLogger(JEConfig.class.getName()).log(Level.SEVERE, null, ex);
                        //                            }
                    }
                });
            }

        }
    });

    AnchorPane.setTopAnchor(login, 0.0);
    AnchorPane.setRightAnchor(login, 0.0);
    AnchorPane.setLeftAnchor(login, 0.0);
    AnchorPane.setBottomAnchor(login, 0.0);
    //@AITBilal - Login Dialog
    scene = new Scene(jeconfigRoot, bounds.getWidth(), bounds.getHeight());
    scene.getStylesheets().add("/styles/Styles.css");
    primaryStage.getIcons().add(getImage("1393354629_Config-Tools.png"));
    primaryStage.setTitle("JEConfig");
    primaryStage.setScene(scene);
    maximize(primaryStage);
    primaryStage.show();

    //        Platform.runLater(new Runnable() {
    //            @Override
    //            public void run() {
    //@AITBilal - Inhalt bzw. die Elemente von LoginDialog
    jeconfigRoot.getChildren().setAll(login);
    //            }
    //        });

    primaryStage.onCloseRequestProperty().addListener(new ChangeListener<EventHandler<WindowEvent>>() {

        @Override
        public void changed(ObservableValue<? extends EventHandler<WindowEvent>> ov,
                EventHandler<WindowEvent> t, EventHandler<WindowEvent> t1) {
            try {
                System.out.println("Disconnect");
                ds.disconnect();
            } catch (JEVisException ex) {
                Logger.getLogger(JEConfig.class.getName()).log(Level.SEVERE, null, ex);
            }
        }
    });
}

From source file:se.trixon.mapollage.ui.config.FoldersTab.java

private void createUI() {
    VBox leftBox = new VBox();
    VBox rightBox = new VBox();

    setContent(leftBox);//w  w  w  . j  a va2  s. co  m

    //Left Pane
    Label rootNameLabel = new Label(mBundle.getString("FoldersTab.rootNameLabel"));
    Label rootDescLabel = new Label(mBundle.getString("FoldersTab.rootDescriptionLabel"));
    Label regexLabel = new Label(Dict.DEFAULT_VALUE.toString());

    leftBox.getChildren().addAll(rootNameLabel, mRootNameTextField, rootDescLabel, mRootDescTextArea, rightBox);

    VBox.setVgrow(mRootDescTextArea, Priority.ALWAYS);

    //Right Pane
    mFolderByDirectoryRadioButton.setToggleGroup(mToggleGroup);
    mFolderByDateRadioButton.setToggleGroup(mToggleGroup);
    mFolderByRegexRadioButton.setToggleGroup(mToggleGroup);
    mFolderByNoneRadioButton.setToggleGroup(mToggleGroup);

    mDatePatternComboBox.setMaxWidth(Double.MAX_VALUE);
    mDatePatternComboBox.setEditable(true);
    mDatePatternComboBox
            .setItems(FXCollections.observableList(Arrays.asList(mBundle.getString("dateFormats").split(";"))));

    Label label = new Label(mBundle.getString("FoldersTab.folderByLabel"));
    rightBox.getChildren().addAll(label, mFolderByDirectoryRadioButton, mFolderByDateRadioButton,
            mDatePatternComboBox, mFolderByRegexRadioButton, mRegexTextField, regexLabel,
            mRegexDefaultTextField, mFolderByNoneRadioButton);

    addTopPadding(rootDescLabel, mFolderByDirectoryRadioButton, mFolderByDateRadioButton,
            mFolderByRegexRadioButton, regexLabel, mFolderByNoneRadioButton, rightBox);

    Insets leftInsets = new Insets(0, 0, 0, 24);
    VBox.setMargin(mDatePatternComboBox, leftInsets);
    VBox.setMargin(mRegexTextField, leftInsets);
    VBox.setMargin(mRegexDefaultTextField, leftInsets);
    VBox.setMargin(regexLabel, leftInsets);

    mDatePatternComboBox.disableProperty().bind(mFolderByDateRadioButton.selectedProperty().not());
    mRegexTextField.disableProperty().bind(mFolderByRegexRadioButton.selectedProperty().not());
    mRegexDefaultTextField.disableProperty().bind(mFolderByRegexRadioButton.selectedProperty().not());

    //        EventHandler eventHandler = (EventHandler) (Event event) -> {
    ////            sValidationSupport.initInitialDecoration();
    //            sValidationSupport.getValidationDecorator().removeDecorations(mDatePatternComboBox);
    //
    //            sValidationSupport.redecorate();
    //            System.out.println(event);
    //        };
    //
    //        mFolderByDateRadioButton.setOnAction(eventHandler);
    //        mFolderByDirectoryRadioButton.setOnAction(eventHandler);
    //        mFolderByNoneRadioButton.setOnAction(eventHandler);
    //        mFolderByRegexRadioButton.setOnAction(eventHandler);
}

From source file:com.thomaskuenneth.tkmactuning.TKMacTuning.java

private void addPlugin(TabPane tabPane, String className, String pluginName) {
    try {/*from  www  .jav  a  2 s  .  c  om*/
        Class clazz = Class.forName(className);
        Constructor cons = clazz.getConstructor(TKMacTuning.class, String.class);
        AbstractPlugin plugin = (AbstractPlugin) cons.newInstance(this, pluginName);
        String primaryUICategory = plugin.getPrimaryUICategory();
        Tab tab = (Tab) tabPane.getProperties().get(primaryUICategory);
        if (tab == null) {
            tab = new Tab(primaryUICategory);
            tabPane.getProperties().put(primaryUICategory, tab);
            tabPane.getTabs().add(tab);
            VBox content = new VBox();
            content.setPadding(LayoutConstants.PADDING_1);
            content.setSpacing(LayoutConstants.VERTICAL_CONTROL_GAP);
            tab.setContent(content);
        }
        VBox content = (VBox) tab.getContent();
        Node node = plugin.getNode();
        if (node != null) {
            String secondaryUICategory = plugin.getSecondaryUICategory();
            if (AbstractPlugin.ROOT.equals(secondaryUICategory)) {
                content.getChildren().add(node);
            } else {
                Pane group = (Pane) tabPane.getProperties().get(GROUP + secondaryUICategory);
                if (group == null) {
                    group = new VBox(LayoutConstants.VERTICAL_CONTROL_GAP);
                    tabPane.getProperties().put(GROUP + secondaryUICategory, group);
                    HBox headline = new HBox();
                    headline.setStyle(
                            "-fx-border-insets: 0 0 1 0; -fx-border-color: transparent transparent -fx-text-box-border transparent; -fx-border-width: 1;");
                    headline.getChildren().add(new Label(secondaryUICategory));
                    group.getChildren().add(headline);
                    content.getChildren().add(group);
                }
                group.getChildren().add(node);
            }
        } else {
            LOGGER.log(Level.SEVERE, "could not create control for plugin {0}({1})",
                    new Object[] { className, pluginName });
        }
    } catch (InstantiationException | ClassNotFoundException | NoSuchMethodException | SecurityException
            | InvocationTargetException | IllegalAccessException ex) {
        LOGGER.log(Level.SEVERE, "addPlugin()", ex);
    }
}

From source file:de.rkl.tools.tzconv.view.ZoneIdSelectionDialog.java

private Node createZoneIdSelectionBox() {
    final HBox mainListBox = new HBox(5);
    partition(newArrayList(ApplicationModel.ZONE_OFFSETS_2_ZONE_IDS.values()), 40).forEach(zoneIds -> {
        final VBox columnBox = new VBox(5);
        zoneIds.forEach(zoneId -> {/*  w w w  .j  a v a 2s . c  om*/
            final CheckBox zoneIdCheckbox = new CheckBox(zoneId.toString());
            zoneIdCheckbox.setSelected(applicationModel.selectedZoneIds.contains(zoneId));
            zoneIdCheckbox.selectedProperty().addListener((observable, oldValue, newValue) -> {
                if (newValue) {
                    pendingSelectedZoneIds.add(zoneId);
                } else {
                    pendingSelectedZoneIds.remove(zoneId);
                }
            });
            columnBox.getChildren().add(zoneIdCheckbox);
            zoneIdCheckboxes.add(zoneIdCheckbox);
        });
        mainListBox.getChildren().add(columnBox);
    });
    return mainListBox;
}