I've been given a project to do in which I have to roll 3 dice, and count the number of middle dots and dots everywhere else separately, and enter them in order to gain score. I've already made this game playable on the console in NetBeans, but when it comes to me trying to implement it into GUI, I'm stumped. I'm a complete beginner to making the GUI and not sure how to make images appear according to what the number on the die was rolled. Every time I try, either the images won't change if I re-roll the dice, or I'm simply having trouble linking the GUI to my code. So how should I make the images appear on the 3 panels in the JPanel according to what number I rolled on each die?
Here's the main part of the code:
for(i = 0; i < 3; i++){
System.out.println("Enter any number to roll the dice: ");
cont = scan.nextInt();
//Rolling 3 dice:
dice1 = rollDice();
dice2 = rollDice();
dice3 = rollDice();
..........................
Basically I want it to show image files that, for example, shows the first die with 1 dot in it if it rolls 1 on a panel to the left, the second die with a 3 in it on a panel in the middle, and the third die with a 5 on a panel to the right on a JPanel and it should change appropriately every time I roll the dice.
I've been trying to make this work for ages! Help would be greatly appreciated. Please mind though, I want this to be as simple as possible for the project's sake. I'm just a first semester computer science student who's never done any GUI in class (nor any OOP).
Thanks in advance! :)