如何实现两个控制组之间的保证金

时间:2018-01-08 18:32:54

标签: javafx javafx-8 javafx-2

我有以下fxml。在每个控制组之后我想要一些空间。怎么做到这一点?

        <Label styleClass="field-view-label" text="%sections.right.section.model-editor.fieldName" />
        <TextField fx:id="fieldName" styleClass="field-view-text" />
        <Label styleClass="field-view-label" text="%sections.right.section.model-editor.fieldType" />
        <ComboBox fx:id="fieldDataType" styleClass="field-view-combobox" />
        <Label styleClass="field-view-label" text="Field Reference" />
        <ComboBox fx:id="fieldReference" styleClass="field-view-combobox" />
        <Label styleClass="field-view-label" text="%sections.right.section.model-editor.reference" />
        <TextField fx:id="fieldValue" styleClass="field-view-text" />

CSS

.field-header-label{
    -fx-pref-width: 460.0px;
}

.field-view-label {
    -fx-pref-width: 460.0px;
}

.field-view-combobox {
    -fx-pref-width: 460.0px;
}

.field-view-text {
    -fx-pref-width: 460.0px;
}

triggers

1 个答案:

答案 0 :(得分:2)

LabelTextField中的每个VBox换行,并为VBox添加填充。类似的东西:

<VBox styleClass="control">
    <Label styleClass="field-view-label" text="%sections.right.section.model-editor.fieldName" />
    <TextField fx:id="fieldName" styleClass="field-view-text" />
</VBox>
<VBox styleClass="control">
    <Label styleClass="field-view-label" text="%sections.right.section.model-editor.fieldType" />
    <ComboBox fx:id="fieldDataType" styleClass="field-view-combobox" />
</VBox>
<VBox styleClass="control">
    <Label styleClass="field-view-label" text="Field Reference" />
    <ComboBox fx:id="fieldReference" styleClass="field-view-combobox" />
</VBox>
<VBox styleClass="control">
    <Label styleClass="field-view-label" text="%sections.right.section.model-editor.reference" />
    <TextField fx:id="fieldValue" styleClass="field-view-text" />
</VBox>

.control {
    -fx-padding: 0 0 0 10 ;
}

/* ... */