Example usage for javafx.scene.layout VBox VBox

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

Introduction

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

Prototype

public VBox(double spacing, Node... children) 

Source Link

Document

Creates an VBox layout with the specified spacing between children.

Usage

From source file:Main.java

public void start(Stage stage) {
    Node top = null;/* w w w .j  a va2 s .co  m*/
    Node left = null;

    VBox center = getCenter();

    Button okBtn = new Button("Ok");
    Button cancelBtn = new Button("Cancel");

    okBtn.setMaxWidth(Double.MAX_VALUE);
    VBox right = new VBox(okBtn, cancelBtn);
    right.setStyle("-fx-padding: 10;");

    Label statusLbl = new Label("Status: Ready");
    HBox bottom = new HBox(statusLbl);
    BorderPane.setMargin(bottom, new Insets(10, 0, 0, 0));

    BorderPane root = new BorderPane(center, top, right, bottom, left);

    Scene scene = new Scene(root);
    stage.setScene(scene);
    stage.show();
}

From source file:main.TestManager.java

/**
 * Displays given test. Intended for testing and
 * evaluating correct answers. (student mode only)
 * @param test test to display/*from w ww .j  ava 2 s  .co m*/
 * @param stage 
 */
public static void displayTest(Test test, Stage stage) {
    Debugger.println(test.getName() + " - is displayed.");
    TabPane tabPane = new TabPane();
    int counter = 1;
    for (Question q : test.getQuestions()) {
        Label instruction = new Label(q.question);
        instruction.setStyle("-fx-font-size: 20");
        Pane choices = q.getPaneOfChoices();
        VBox vbox = new VBox(instruction, choices);
        vbox.setSpacing(10);
        Tab tab = new Tab("Otzka " + Integer.toString(counter), vbox);
        tab.setStyle("-fx-font-size: 20");
        tabPane.getTabs().add(tab);
        counter++;
    }

    Button finish = new Button("Ukon?i test!");
    finish.setStyle("-fx-font-size: 20");
    finish.setOnAction(new EventHandler<ActionEvent>() {
        @Override
        public void handle(ActionEvent event) {
            try {
                test.evaluate(stage);
            } catch (IOException e) {
                Alert alert = new Alert(AlertType.ERROR);
                alert.setContentText("Ojoj, vyskytol sa problm. Aplikcia sa mus ukon?i.");
                alert.showAndWait();
                System.exit(0);
            }
        }
    });
    Button nextQuestion = new Button("alia");
    nextQuestion.setStyle("-fx-font-size: 20");
    nextQuestion.setOnAction(e -> tabPane.getSelectionModel().selectNext());
    HBox buttons = new HBox(finish, nextQuestion);
    buttons.setSpacing(10);
    buttons.setAlignment(Pos.BOTTOM_CENTER);
    VBox outerVBox = new VBox(tabPane, buttons);
    outerVBox.setPadding(new Insets(10, 10, 10, 10));
    Scene scene = new Scene(outerVBox);
    stage.setScene(scene);
    stage.show();
}

From source file:Main.java

@Override
public void start(Stage stage) throws Exception {
    genderFld.getItems().addAll("Male", "Fenale", "Unknwon");

    dataFld.setPrefColumnCount(30);/*from  ww w .j  ava  2s .  c o  m*/
    dataFld.setPrefRowCount(5);

    GridPane grid = new GridPane();
    grid.setHgap(5);
    grid.setVgap(5);

    // Place the controls in the grid   
    grid.add(fNameLbl, 0, 0); // column=0, row=0
    grid.add(lNameLbl, 0, 1); // column=0, row=1
    grid.add(bDateLbl, 0, 2); // column=0, row=2
    grid.add(genderLbl, 0, 3); // column=0, row=3

    grid.add(fNameFld, 1, 0); // column=1, row=0
    grid.add(lNameFld, 1, 1); // column=1, row=1
    grid.add(bDateFld, 1, 2); // column=1, row=2
    grid.add(genderFld, 1, 3); // column=1, row=3
    grid.add(dataFld, 1, 4, 3, 2); // column=1, row=4, colspan=3, rowspan=3

    VBox buttonBox = new VBox(saveBtn, closeBtn);
    saveBtn.setMaxWidth(Double.MAX_VALUE);
    closeBtn.setMaxWidth(Double.MAX_VALUE);

    grid.add(buttonBox, 2, 0, 1, 2); // column=2, row=0, colspan=1, rowspan=2

    saveBtn.setOnAction(e -> showData());

    closeBtn.setOnAction(e -> stage.hide());

    Scene scene = new Scene(grid);
    stage.setScene(scene);
    stage.setTitle("Person Details");
    stage.sizeToScene();
    stage.show();
}

From source file:com.thomaskuenneth.openweathermapweather.BasicView.java

public BasicView(String name) {
    super(name);//from   ww  w  .  ja v a  2s .  co m
    bundle = ResourceBundle.getBundle("com.thomaskuenneth.openweathermapweather.strings");
    city = new TextField();
    city.setFloatText(bundle.getString("hint"));
    Button show = new Button(bundle.getString("anzeigen"));
    image = new ImageView();
    temperatur = new Text();
    beschreibung = new Text();
    VBox texts = new VBox(temperatur, beschreibung);
    HBox hb1 = new HBox(10, image, texts);
    hb1.setPadding(new Insets(10, 0, 0, 0));
    hb1.setAlignment(Pos.TOP_LEFT);
    show.setOnAction(e -> doIt());
    VBox controls = new VBox(10, city, show, hb1);
    controls.setPadding(new Insets(14, 14, 14, 14));
    controls.setAlignment(Pos.TOP_LEFT);
    setCenter(controls);
}

From source file:org.pdfsam.ui.module.Footer.java

public Footer(RunButton runButton, OpenButton openButton, String ownerModule) {
    this.ownerModule = defaultString(ownerModule);
    this.openButton = openButton;
    this.runButton = runButton;
    this.getStyleClass().addAll("pdfsam-container", "footer-pane");
    this.statusLabel.getStyleClass().add("status-label");
    this.statusLabel.setVisible(false);
    this.bar.setMaxWidth(Double.MAX_VALUE);
    this.bar.getStyleClass().add("pdfsam-footer-bar");
    this.statusLabel.setMaxHeight(Double.MAX_VALUE);
    VBox progressPane = new VBox(statusLabel, bar);
    progressPane.getStyleClass().add("progress-pane");
    VBox.setVgrow(statusLabel, Priority.ALWAYS);
    HBox.setHgrow(bar, Priority.ALWAYS);
    HBox.setHgrow(progressPane, Priority.ALWAYS);
    this.failed.setVisible(false);
    StackPane buttons = new StackPane(failed, openButton);
    buttons.setAlignment(Pos.CENTER_LEFT);
    this.getChildren().addAll(runButton, buttons, progressPane);
    eventStudio().add(TaskExecutionRequestEvent.class, e -> {
        if (e.getModuleId().equals(ownerModule)) {
            failed.setVisible(false);/* ww  w .  ja v a2 s  .c  om*/
            openButton.setVisible(false);
            statusLabel.setVisible(true);
            statusLabel.setText(DefaultI18nContext.getInstance().i18n("Requested"));
            bar.setProgress(0);
        }
    });
    eventStudio().addAnnotatedListeners(this);
}

From source file:org.sleuthkit.autopsy.timeline.ui.detailview.EventStripeNode.java

public EventStripeNode(EventDetailsChart chart, EventStripe eventStripe, EventClusterNode parentNode) {
    super(chart, eventStripe, parentNode);

    setMinHeight(48);/*from   w ww .  ja  va  2 s  .c  om*/

    EventDetailsChart.HideDescriptionAction hideClusterAction = chart.new HideDescriptionAction(
            getDescription(), eventBundle.getDescriptionLoD());
    hideButton = ActionUtils.createButton(hideClusterAction, ActionUtils.ActionTextBehavior.HIDE);
    configureLoDButton(hideButton);

    infoHBox.getChildren().add(hideButton);
    //setup description label
    eventTypeImageView.setImage(getEventType().getFXImage());
    descrLabel.setPrefWidth(USE_COMPUTED_SIZE);
    descrLabel.setTextOverrun(OverrunStyle.CENTER_ELLIPSIS);
    descrLabel.setGraphic(eventTypeImageView);

    setAlignment(subNodePane, Pos.BOTTOM_LEFT);
    for (EventCluster cluster : eventStripe.getClusters()) {
        EventClusterNode clusterNode = new EventClusterNode(chart, cluster, this);
        subNodes.add(clusterNode);
        subNodePane.getChildren().addAll(clusterNode);
    }

    getChildren().addAll(new VBox(infoHBox, subNodePane));
    setOnMouseClicked(new MouseClickHandler());
}

From source file:ambroafb.clients.dialog.ClientDialogController.java

private void changeSceneVisualAsPerson(String delimiter) {
    first_name.setText(conf.getTitleFor("first_name"));
    last_name.setText(conf.getTitleFor("last_name"));

    VBox lastNameVBox = new VBox(last_name, lastName);
    namesRootPane.getChildren().add(1, lastNameVBox);
    lastNameVBox.getStyleClass().add("couple");

    setStylesForNamesPaneElements("oneThirds", "couple", "couple");

    String firmDescrip = firstName.getText();
    String firstNameText = StringUtils.substringBeforeLast(firmDescrip, delimiter);
    String lastNameText = StringUtils.substringAfterLast(firmDescrip, delimiter);
    firstName.setText(firstNameText.trim());
    lastName.setText(lastNameText.trim());
}

From source file:de.pixida.logtest.designer.logreader.LogReaderEditor.java

private void createDialogItems() {
    Validate.notNull(this.logReader); // Will be used to initialize input field values

    // CHECKSTYLE:OFF Yes, we are using lots of constants here. It does not make sense to name them using final variables.
    final GridPane gp = new GridPane();
    gp.setAlignment(Pos.BASELINE_LEFT);//from   w w w.ja  v a2 s. com
    gp.setHgap(10d);
    gp.setVgap(15d);
    gp.setPadding(new Insets(5d));
    final ColumnConstraints column1 = new ColumnConstraints();
    final ColumnConstraints column2 = new ColumnConstraints();
    column1.setHgrow(Priority.NEVER);
    column2.setHgrow(Priority.SOMETIMES);
    gp.getColumnConstraints().addAll(column1, column2);
    this.insertConfigItemsIntoGrid(gp, this.createConfigurationForm());
    final TitledPane configPane = new TitledPane("Edit Configuration", gp);
    configPane.setGraphic(Icons.getIconGraphics("pencil"));
    configPane.setCollapsible(false);

    final VBox lines = this.createRunForm();
    final TitledPane testPane = new TitledPane("Test Configuration", lines);
    testPane.setGraphic(Icons.getIconGraphics("script_go"));
    testPane.setCollapsible(false);

    final VBox panes = new VBox(configPane, testPane);
    panes.setSpacing(10d);
    final ScrollPane sp = new ScrollPane(panes);
    sp.setPadding(new Insets(10d));
    sp.setFitToWidth(true);
    this.setCenter(sp);
    // CHECKSTYLE:ON
}

From source file:org.sleuthkit.autopsy.timeline.ui.AbstractTimelineChart.java

/**
 * Constructor/*w w w  .  jav a 2s . c  o m*/
 *
 * @param controller The TimelineController for this view.
 */
protected AbstractTimelineChart(TimeLineController controller) {
    super(controller);
    Platform.runLater(() -> {
        VBox vBox = new VBox(getSpecificLabelPane(), getContextLabelPane());
        vBox.setFillWidth(false);
        HBox hBox = new HBox(getSpacer(), vBox);
        hBox.setFillHeight(false);
        setBottom(hBox);
        DoubleBinding spacerSize = getYAxis().widthProperty().add(getYAxis().tickLengthProperty())
                .add(getAxisMargin());
        getSpacer().minWidthProperty().bind(spacerSize);
        getSpacer().prefWidthProperty().bind(spacerSize);
        getSpacer().maxWidthProperty().bind(spacerSize);
    });

    createSeries();

    selectedNodes.addListener((ListChangeListener.Change<? extends NodeType> change) -> {
        while (change.next()) {
            change.getRemoved().forEach(node -> applySelectionEffect(node, false));
            change.getAddedSubList().forEach(node -> applySelectionEffect(node, true));
        }
    });

    //show tooltip text in status bar
    hoverProperty().addListener(
            hoverProp -> controller.setStatusMessage(isHover() ? getDefaultTooltip().getText() : ""));

}

From source file:de.pixida.logtest.designer.testrun.TestRunEditor.java

private void createDialogItems() {
    final TitledPane configPane = this.createPanelForConfiguration();
    final TitledPane runPane = this.createPanelForLaunchingTests();
    final VBox panes = new VBox(configPane, runPane);
    final double insetsOfScrollPane = 10d;
    final double spacingOfPanes = insetsOfScrollPane;
    panes.setSpacing(spacingOfPanes);//from   ww  w . j  a  v a  2  s .co  m
    final ScrollPane sp = new ScrollPane(panes);
    sp.setPadding(new Insets(insetsOfScrollPane));
    sp.setFitToWidth(true);
    this.setCenter(sp);
}