Questions tagged [gridpane]

GridPane lays out its children within a flexible grid of rows and columns

GridPane lays out its children within a flexible grid of rows and columns. If a border and/or padding is set, then its content will be layed out within those insets. A child may be placed anywhere within the grid and may span multiple rows/columns. Children may freely overlap within rows/columns and their stacking order will be defined by the order of the gridpane's children list (0th node in back, last node in front).

GridPane may be styled with backgrounds and borders using CSS

349 questions
2
votes
1 answer

JavaFX - Iterate GridPane nodes per row - Read Nodes of GridPane per row

I am creating an application using JavaFX 8. I change the content of a grid pane dynamically using drag/drop. I wish to iterate GridPane contents per row or per row/col. JavaFX allows adding nodes in a GridPane by specifying the row and column. …
Georgios Syngouroglou
  • 18,813
  • 9
  • 90
  • 92
2
votes
2 answers

Fit VBox to parent GridPane

I have GridPane which has two columns: first contains fixed-size ImageView, the second has VBox with Text elements. I need this VBox to fit the column width. Grid has right dimensions, ImageView too, but VBox in second column fits to text which it…
Paweł Wójcik
  • 133
  • 1
  • 14
2
votes
0 answers

JavaFX add gridPane to FXML file

I have a FXML file with a gridpane in it, and want to add another item in it with JavaFX. If I dont use the FXML file, I can add items in the gridpane. How to add items in the fxml gridpane? (thought something with getChildren.add, but cant find…
Geert Berkers
  • 653
  • 7
  • 19
2
votes
1 answer

How to add the rows dynamically on gridpane in Java FX?

I have a DB log in form on a single row as below, // Hostname Input Label hostName = new Label("Host:"); grid.add(hostName, 0, 2); final TextField host = new TextField(); host.getText(); GridPane.setConstraints(host, 1,…
Keibee
  • 45
  • 1
  • 5
2
votes
2 answers

How to set the distance to the border in a GridPane?

I am unable to find a way to set the distance to the border in a GridPane. Now, the text starts immediately after the border stops, which is not very nice for the design. I could give all the children a padding, but I was thinking there must be a…
bashoogzaad
  • 4,611
  • 8
  • 40
  • 65
2
votes
1 answer

JavaFX: Best way to update GridPane after row deletion?

I am using a GridPane (inside a ScrollPane) as a table with user entries. Each row incorporates a username (Label), an icon depicting its state (ImageView) and two buttons, the second of which is used to delete the user entry. The two images below…
pkaramol
  • 16,451
  • 43
  • 149
  • 324
2
votes
1 answer

JavaFX - Inflating a GridPane to parent's size

I am trying to create a GUI for one of my programs. This is my first time using JavaFX. For starters, I would like to have a GridPane that takes up the entire window. I have tried everything I could find: setMinWidth/Height, setPrefSize, minWidth,…
LoneDuck
  • 1,852
  • 1
  • 21
  • 28
2
votes
1 answer

how to add imageviews to gridpane using a forloop

here's my code.this prompts a exception saying "IllegalArgumentException: Children: duplicate children added: parent = Grid hgap=5.0, vgap=5.0, alignment=TOP_LEFT" File file = new File("D:\SERVER\Server Content\Apps\icons"); File[]…
2
votes
1 answer

How do I constrain nodes added to a GridPane in code?

I have a need to add custom JavaFX controls to a grid pane in code. I set up the grid pane row and column constraints like so: //These are doubles for the purposes of calculating more accurate percentages, see below. //I feel like there should be a…
Will
  • 3,413
  • 7
  • 50
  • 107
1
vote
1 answer

How do I make all the fields in my javafx form clickable using GridPane and HBox?

I want to make a form with three sections, two with fields and one with buttons. public class Form extends Application{ public static void main(String[] args) { launch(args); } @Override public void start(Stage…
Con Test
  • 13
  • 2
1
vote
1 answer

JavaFX set margins for items in GridPane

I am trying to get some better layout and for that I would like to setMargin for my items inside a GridPane. This is what I tried (only for the first idLabel, idTextField, nameLabel, nameTextField for testing): private Pane createCenterPane() { …
Chris
  • 1,828
  • 6
  • 40
  • 108
1
vote
0 answers

Change exactly one label background color in JavaFx

I'm trying to create Tetris. I created GridPane and filled width and height with labels using nested for loop, then putted GridPane in to the scene. How can I change certain label background all labels have coordinates. I want to change label…
Jules
  • 85
  • 1
  • 12
1
vote
2 answers

How do fix 'Illegal Argument Exception' using onMouseClicked on my GridPane?

Obligatory apologies for being new to Java etc. With that out of the way, I'm trying to develop a simple game. At the moment, all I want to do is be able to move the counter around the board, however I get error messages whenever i do this. It seems…
Haggishunt56
  • 39
  • 1
  • 9
1
vote
1 answer

JavaFX button set image

I am trying to set an image to a button but I can't get a working result. My button is located in gridpane. Image mine = new Image(new File("..some path").toURI().toString()); ImageView im = new…
Saliery
  • 155
  • 5
  • 16
1
vote
2 answers

Javafx How to locate a specific button in a GridPane

I'm making a checkers game with buttons. To kill another piece, you have to move your piece diagonally over the other piece, but I'm not sure how to ensure that your piece moved over the other piece. The idea I have for solving this problem is…
Travelsbyfire
  • 35
  • 1
  • 10