Example usage for javafx.scene.layout FlowPane setHgap

List of usage examples for javafx.scene.layout FlowPane setHgap

Introduction

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

Prototype

public final void setHgap(double value) 

Source Link

Usage

From source file:Main.java

License:asdf

@Override
public void start(Stage stage) {
    stage.setTitle("HTML");
    stage.setWidth(500);//from   ww w  .j a  va 2 s .co m
    stage.setHeight(500);
    Scene scene = new Scene(new Group());

    FlowPane flow = new FlowPane();
    flow.setVgap(8);
    flow.setHgap(4);
    flow.setPrefWrapLength(300); // preferred width = 300
    for (int i = 0; i < 10; i++) {
        flow.getChildren().add(new Button("asdf"));
    }
    scene.setRoot(flow);

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

From source file:Main.java

License:asdf

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

    FlowPane flow = new FlowPane(Orientation.VERTICAL);
    flow.setVgap(8);
    flow.setHgap(4);
    flow.setPrefWrapLength(300); // preferred width = 300
    for (int i = 0; i < 10; i++) {
        flow.getChildren().add(new Button("asdf"));
    }
    scene.setRoot(flow);

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

From source file:Main.java

@Override
public void start(Stage primaryStage) {
    primaryStage.setTitle("FlowPane example");

    FlowPane flowPane = new FlowPane();
    flowPane.setPadding(new Insets(10, 10, 10, 10));
    flowPane.setVgap(4);//from  w  w w.  j ava2 s .  co  m
    flowPane.setHgap(4);
    flowPane.setPrefWrapLength(210);

    Button btn = new Button();

    for (int i = 0; i < 8; i++) {

        btn = new Button("Button");
        btn.setPrefSize(100, 50);
        flowPane.getChildren().add(btn);

    }

    Scene scene = new Scene(flowPane);
    primaryStage.setScene(scene);
    primaryStage.show();
}

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

@Override
public void start(Stage primaryStage) {
    TabPane tabPane = new TabPane();
    tabPane.setTabClosingPolicy(TabPane.TabClosingPolicy.UNAVAILABLE);
    // Found here: http://stackoverflow.com/a/17488304/5956451
    tabPane.getStyleClass().add("floating");

    // TODO: propper error handling
    JSONTokener t = new JSONTokener(getClass().getResourceAsStream("resources/plugins.json"));
    JSONArray a = new JSONArray(t);
    a.forEach((Object anObject) -> {
        JSONObject jsonObject = (JSONObject) anObject;
        addPlugin(tabPane, jsonObject.getString("class"), jsonObject.getString("pluginName"));
    });// w  w w .  ja v a2s  .  co  m

    FlowPane buttonsPane = new FlowPane(Orientation.HORIZONTAL);
    buttonsPane.setPadding(LayoutConstants.PADDING_1);
    buttonsPane.setHgap(LayoutConstants.HORIZONTAL_CONTROL_GAP);
    buttonsPane.setAlignment(Pos.BASELINE_LEFT);
    final Button buttonReread = new Button(getString("reread"));
    buttonReread.setOnAction(event -> {
        PluginManager.reread(this);
    });
    buttonsPane.getChildren().add(buttonReread);
    final Button buttonApply = new Button(getString("apply"));
    buttonApply.setOnAction(event -> {
        PluginManager.save(this);
    });
    buttonsPane.getChildren().add(buttonApply);

    statusbar = new StatusBar();
    BorderPane borderPane = new BorderPane(tabPane);
    borderPane.setTop(buttonsPane);
    borderPane.setBottom(statusbar);
    primaryStage.setScene(new Scene(borderPane, 800, 600));
    primaryStage.setTitle(getString("application_name"));

    ready();
    primaryStage.show();
}

From source file:io.bitsquare.gui.components.paymentmethods.OKPayForm.java

private void addCurrenciesGrid(boolean isEditable) {
    Label label = addLabel(gridPane, ++gridRow, "Supported currencies:", 0);
    GridPane.setValignment(label, VPos.TOP);
    FlowPane flowPane = new FlowPane();
    flowPane.setPadding(new Insets(10, 10, 10, 10));
    flowPane.setVgap(10);//w w  w . j a v  a2s .c o m
    flowPane.setHgap(10);

    if (isEditable)
        flowPane.setId("flow-pane-checkboxes-bg");
    else
        flowPane.setId("flow-pane-checkboxes-non-editable-bg");

    CurrencyUtil.getAllOKPayCurrencies().stream().forEach(e -> {
        CheckBox checkBox = new CheckBox(e.getCode());
        checkBox.setMouseTransparent(!isEditable);
        checkBox.setSelected(okPayAccount.getTradeCurrencies().contains(e));
        checkBox.setMinWidth(60);
        checkBox.setMaxWidth(checkBox.getMinWidth());
        checkBox.setTooltip(new Tooltip(e.getName()));
        checkBox.setOnAction(event -> {
            if (checkBox.isSelected())
                okPayAccount.addCurrency(e);
            else
                okPayAccount.removeCurrency(e);

            updateAllInputsValid();
        });
        flowPane.getChildren().add(checkBox);
    });

    GridPane.setRowIndex(flowPane, gridRow);
    GridPane.setColumnIndex(flowPane, 1);
    gridPane.getChildren().add(flowPane);
}

From source file:Main.java

private FlowPane addFlowPane() {

    FlowPane flow = new FlowPane();
    flow.setPadding(new Insets(5, 0, 5, 0));
    flow.setVgap(4);/*from   w  w  w. jav  a 2  s. c  o  m*/
    flow.setHgap(4);
    flow.setPrefWrapLength(170); // preferred width allows for two columns
    flow.setStyle("-fx-background-color: DAE6F3;");

    ImageView pages[] = new ImageView[8];
    for (int i = 0; i < 8; i++) {
        pages[i] = new ImageView(
                new Image(Main.class.getResourceAsStream("graphics/chart_" + (i + 1) + ".png")));
        flow.getChildren().add(pages[i]);
    }

    return flow;
}

From source file:io.bitsquare.gui.components.paymentmethods.SepaForm.java

private void addCountriesGrid(boolean isEditable, String title, List<CheckBox> checkBoxList,
        List<Country> dataProvider) {
    Label label = addLabel(gridPane, ++gridRow, title, 0);
    label.setWrapText(true);//from  w  w w  . j a va2 s. co  m
    label.setMaxWidth(180);
    label.setTextAlignment(TextAlignment.RIGHT);
    GridPane.setHalignment(label, HPos.RIGHT);
    GridPane.setValignment(label, VPos.TOP);
    FlowPane flowPane = new FlowPane();
    flowPane.setPadding(new Insets(10, 10, 10, 10));
    flowPane.setVgap(10);
    flowPane.setHgap(10);
    flowPane.setMinHeight(55);

    if (isEditable)
        flowPane.setId("flow-pane-checkboxes-bg");
    else
        flowPane.setId("flow-pane-checkboxes-non-editable-bg");

    dataProvider.stream().forEach(country -> {
        final String countryCode = country.code;
        CheckBox checkBox = new CheckBox(countryCode);
        checkBox.setUserData(countryCode);
        checkBoxList.add(checkBox);
        checkBox.setMouseTransparent(!isEditable);
        checkBox.setMinWidth(45);
        checkBox.setMaxWidth(45);
        checkBox.setTooltip(new Tooltip(country.name));
        checkBox.setOnAction(event -> {
            if (checkBox.isSelected())
                sepaAccount.addAcceptedCountry(countryCode);
            else
                sepaAccount.removeAcceptedCountry(countryCode);

            updateAllInputsValid();
        });
        flowPane.getChildren().add(checkBox);
    });
    updateCountriesSelection(isEditable, checkBoxList);

    GridPane.setRowIndex(flowPane, gridRow);
    GridPane.setColumnIndex(flowPane, 1);
    gridPane.getChildren().add(flowPane);
}