-
Bug
-
Resolution: Not an Issue
-
P4
-
None
-
7u15
-
Windows XP
When I set the vgap property on a GridPane, the vagap is supposed to be added only between adjacent rows. It seems to be a bug that is adding extra space before the first row that is equal to the vgap setting. The hgap property is working fine.
I used JDK8 build62. Please run the following program for an example.
package test;
import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.layout.GridPane;
import javafx.stage.Stage;
public class GridPaneHVGaps extends Application {
public static void main(String[] args) {
Application.launch(args);
}
public void start(Stage stage) {
GridPane root = new GridPane();
// Make the grid lines visible
root.setGridLinesVisible(true);
// Set hgap=5px and vgap=10px
//root.setHgap(5);
root.setVgap(10);
// Add four buttons: two in each of the two rows
root.addRow(1, new Button("One"), new Button("Two"));
root.addRow(2, new Button("Three"), new Button("Four"));
root.addRow(3, new Button("Five"), new Button("Six"));
root.setStyle("-fx-padding: 10");
Scene scene = new Scene(root);
stage.setScene(scene);
stage.setTitle("GridPane hgap and vgap Properties");
stage.show();
}
}
I used JDK8 build62. Please run the following program for an example.
package test;
import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.layout.GridPane;
import javafx.stage.Stage;
public class GridPaneHVGaps extends Application {
public static void main(String[] args) {
Application.launch(args);
}
public void start(Stage stage) {
GridPane root = new GridPane();
// Make the grid lines visible
root.setGridLinesVisible(true);
// Set hgap=5px and vgap=10px
//root.setHgap(5);
root.setVgap(10);
// Add four buttons: two in each of the two rows
root.addRow(1, new Button("One"), new Button("Two"));
root.addRow(2, new Button("Three"), new Button("Four"));
root.addRow(3, new Button("Five"), new Button("Six"));
root.setStyle("-fx-padding: 10");
Scene scene = new Scene(root);
stage.setScene(scene);
stage.setTitle("GridPane hgap and vgap Properties");
stage.show();
}
}