I have created a GridPane with one row and two collumns. In each cell I have placed a Button. I wanted the buttons to fill the whole cell so I set prefWidth="Infinitiy". (I have learned that I should use maxWidth="Infinity" for that purpose but still I think this shouldnt break the runtime or at least give some kind of error message).
Observed behavior when setting prefWidth="Infinity":
- Scene Builder (1.1) instantly freezes when you set the property or if you try to open a file with this property set.
- If the application with this FXML defined GUI is run no GUI appears and the process allocates huge amounts of heap (according to jvisualvm about 1,2GB/s for ArrayLists) that seem to get garbage collected instantly.
Here is FXML to reproduce:
<?xml version="1.0" encoding="UTF-8"?>
<?import java.lang.*?>
<?import java.net.*?>
<?import java.util.*?>
<?import javafx.geometry.*?>
<?import javafx.scene.control.*?>
<?import javafx.scene.image.*?>
<?import javafx.scene.layout.*?>
<?import javafx.scene.paint.*?>
<?import javafx.scene.text.*?>
<GridPane id="GridPane" alignment="TOP_LEFT" disable="false" gridLinesVisible="false" hgap="5.0">
<children>
<Button mnemonicParsing="false" prefWidth="Infinity" styleClass="add-button" text="Save" GridPane.columnIndex="0" GridPane.rowIndex="0" />
<Button mnemonicParsing="false" text="Discard" GridPane.columnIndex="1" GridPane.rowIndex="0" />
</children>
<columnConstraints>
<ColumnConstraints hgrow="SOMETIMES" />
<ColumnConstraints hgrow="SOMETIMES" />
</columnConstraints>
<rowConstraints>
<RowConstraints vgrow="SOMETIMES" />
</rowConstraints>
</GridPane>
Observed behavior when setting prefWidth="Infinity":
- Scene Builder (1.1) instantly freezes when you set the property or if you try to open a file with this property set.
- If the application with this FXML defined GUI is run no GUI appears and the process allocates huge amounts of heap (according to jvisualvm about 1,2GB/s for ArrayLists) that seem to get garbage collected instantly.
Here is FXML to reproduce:
<?xml version="1.0" encoding="UTF-8"?>
<?import java.lang.*?>
<?import java.net.*?>
<?import java.util.*?>
<?import javafx.geometry.*?>
<?import javafx.scene.control.*?>
<?import javafx.scene.image.*?>
<?import javafx.scene.layout.*?>
<?import javafx.scene.paint.*?>
<?import javafx.scene.text.*?>
<GridPane id="GridPane" alignment="TOP_LEFT" disable="false" gridLinesVisible="false" hgap="5.0">
<children>
<Button mnemonicParsing="false" prefWidth="Infinity" styleClass="add-button" text="Save" GridPane.columnIndex="0" GridPane.rowIndex="0" />
<Button mnemonicParsing="false" text="Discard" GridPane.columnIndex="1" GridPane.rowIndex="0" />
</children>
<columnConstraints>
<ColumnConstraints hgrow="SOMETIMES" />
<ColumnConstraints hgrow="SOMETIMES" />
</columnConstraints>
<rowConstraints>
<RowConstraints vgrow="SOMETIMES" />
</rowConstraints>
</GridPane>
- duplicates
-
JDK-8093059 Layouts have problems with handling NaN and Infinity values
- Closed