I've written the code below and that's the output. Is it possible to make all of the rows and columns(cells) visible and to make all of them certain size? The result I want is to have some sort of "net", so I can put in something into a cell and be sure that the size of all table will remain the same.
GridPane.setVgap()
and GridPane.setMinSize()
is not what I'm looking for.
package sample;
import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.layout.GridPane;
import javafx.stage.Stage;
import javafx.scene.control.Button;
public class Main extends Application {
Stage window;
@Override
public void start(Stage primaryStage) throws Exception{
window = primaryStage;
GridPane grid = new GridPane();
//buttons
Button btn = new Button("8,5");
GridPane.setConstraints(btn, 8,5);
Button btn2 = new Button("1,3");
GridPane.setConstraints(btn2, 1,3);
grid.getChildren().addAll(btn, btn2);
grid.setGridLinesVisible(true);
Scene scene = new Scene(grid, 600,400);
window.setScene(scene);
window.show();
}
public static void main(String[] args) {
launch(args);
}
}
Thanks in advance!