#Draw a 5x5 grid and randomly assign a value to each cell and then draw that value in the cell

1 messages · Page 1 of 1 (latest)

boreal pier
#

Just as the title says, but emphasis on the randomly, I want each cell to have drawn a random value.

I know how I'd do it but I have no idea how to really start.

I'd probably first figure out how to draw a grid,
then store the values I want maybe in an array.

for example, the alphabet.

Then I'd have to somehow make the program know there's 25 cells and then draw in them randomly each time I run the program.

magic roseBOT
#

<@&987246487241105418> please have a look, thanks.

magic roseBOT
#

While you are waiting for getting help, here are some tips to improve your experience:

Code is much easier to read if posted with syntax highlighting and proper formatting.

If nobody is calling back, that usually means that your question was not well asked and hence nobody feels confident enough answering. Try to use your time to elaborate, provide details, context, more code, examples and maybe some screenshots. With enough info, someone knows the answer for sure.

Don't forget to close your thread using the command </help-thread close:1027500463647621170> when your question has been answered, thanks.

round sail
#

Use a grid view and add make a double for loop to add elements to it (probably something simple like a new Label(rng) ) and ur done

#

heres a summary of it (GridPane)

#

TilePane is another option, probably a bit easier for what u want

#

with tilepane you dont even have to specify the position, just set the prefColumns to 5 (i believe it actually defaults to 5)

#

then u just do a 1D for loop up to 25

#

tilepane.getChildren().add(new Label(value)) is how u do it, its not in my notes oops