reset password
Author Message
JamBaby
Posts: 6
Posted 22:34 Nov 14, 2018 |

for the problem 1 in this weeks assignment im using a random class to randomize the numbers, but how do i wrap the integers to strings?

kbenavente
Posts: 4
Posted 22:43 Nov 14, 2018 |

I’m guessing you’re using the ImageView node which accepts a String object as a constructor which would be the path name.

If you are generating a random integer value, you can simply concatenate the integer with the text inside the constructor.

Example:

int number = 1;

new ImageView(“cards/“ + number + “.png”);

JamBaby
Posts: 6
Posted 23:04 Nov 14, 2018 |
kbenavente wrote:

I’m guessing you’re using the ImageView node which accepts a String object as a constructor which would be the path name.

If you are generating a random integer value, you can simply concatenate the integer with the text inside the constructor.

Example:

int number = 1;

new ImageView(“cards/“ + number + “.png”);

i thought about doing that but i assumed this way wouldnt work thank you.