Java Code Examples for javafx.scene.Node#setId()

The following examples show how to use javafx.scene.Node#setId() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: FormPane.java    From marathonv5 with Apache License 2.0 6 votes vote down vote up
public FormPane addFormField(String text, Node... fields) {
    Label label = new Label(text);
    String labelId = idText(text);
    label.setId(labelId);
    GridPane.setValignment(label, VPos.TOP);
    int column = 0;
    add(label, column++, currentRow, 1, 1);
    int colspan = columns - fields.length;
    int fieldIndex = 1;
    for (Node field : fields) {
        field.setId(labelId + "-field-" + fieldIndex);
        setFormConstraints(field);
        GridPane.setValignment(field, VPos.TOP);
        add(field, column++, currentRow, colspan, 1);
        fieldIndex++;
    }
    currentRow++;
    column = 0;
    return this;
}
 
Example 2
Source File: FormPane.java    From marathonv5 with Apache License 2.0 5 votes vote down vote up
public FormPane addFormField(String text, Node field, int colSpan, int rowSpan) {
    Label label = new Label(text);
    String labelId = idText(text);
    label.setId(labelId);
    GridPane.setValignment(label, VPos.TOP);
    int column = 0;
    add(label, column++, currentRow, 1, 1);
    field.setId(labelId + "-field-1");
    setFormConstraints(field);
    GridPane.setValignment(field, VPos.TOP);
    add(field, column++, currentRow, colSpan, rowSpan);
    currentRow += rowSpan;
    column = 0;
    return this;
}