I'm extremely new JavaFX (and any GUI for that matter), and I'm having troubles with understanding some concepts. That said, I have 10x10 multi-dimensional array that stores random int
's within a class that extends GridPane
, and I'm having troubles understanding how I would display each random int
value graphically in the center of a BorderPane
of another class. I would like each int
of every element to be shown in a shape of sorts uniformly. I don't want to know an exact solution. I just want to be aware of what options and steps I should take e.g. imports I should be aware of etc. Found this image from a different post, but this the kind of layout I imagine, except I don't need them to be buttons
Asked
Active
Viewed 2,669 times
0

LumberSzquatch
- 1,054
- 3
- 23
- 46
-
Showing an illustration of your desired view would be helpful. – Uluk Biy Oct 27 '14 at 05:27
-
Just added an image from a different post. That's pretty much the layout I would like, I just don't need them to be buttons. Can that be done? – LumberSzquatch Oct 27 '14 at 14:35
1 Answers
1
Build a (probably nested) loop and traverse the 2d-array. On each cycle get the int value from the class and put into one of appropriate built-in layout panes of JavaFX. I suggest to use another general/master GridPane
or TilePane
. Then put this master pane to center of BorderPane
.

Uluk Biy
- 48,655
- 13
- 146
- 153
-
Two things, and excuse my ignorance. When you say get the `int` value from the class, are you referring to the value at each index of the array? And you mentioned a general/master `GridPane`, what is that? Another one as in another class aside from my class that extends GridPane? – LumberSzquatch Oct 27 '14 at 15:38
-
@ZFN7. 1) No, the value of the your class that extends Gridpane. 2) Yes, to get the grid view like in your image you need to use one of built-in layouts. – Uluk Biy Oct 27 '14 at 17:28