I'm trying to make a gui program that has a button, and when you click it, you roll a die from 1 to 6 and an image of the die comes up. But when I try to generate a number between 1 and 6, an errors saying symbol cannot be found comes up.
int rolledNumber = random.nextInt(max - min + 1) + min;
Ii already declared max and min as 6 and 1.
I'm also getting errors at the part where I try to get a random int between 1 and 6. And the code I use to open the image seems to be wrong.
`
img = ImageIO.read(new File("dice 1.jpeg"));
Here's my code:
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import java.util.*;
import java.util.Random;
public class Butttin {  
    public static void main(String[] args) {    
        JFrame frame = new JFrame("Rolling Dice Game");
        JPanel panel = new JPanel();
        JButton buttonRoll = new JButton("Roll!");
        buttonRoll.addActionListener(new buttonRoll()); 
        panel.setLayout(new GridLayout(5, 2, 5, 5));
        frame.setVisible(true);
        frame.setSize(500, 500);
        frame.setResizable(false);
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        frame.setContentPane(panel);
        frame.pack();
    }
    private static class buttonRoll implements ActionListener {
        public void actionPerformed(ActionEvent event) {
            int max = 6;
            int min = 1;
            int rolledNumber = random.nextInt(max - min + 1) + min;
            String command  = event.getActionCommand();
            if (command == "Roll!") {
                if (rolledNumber == 1) {
                    JLabel die = new JLabel();
                    img = ImageIO.read(new File("dice 1.jpeg"));
                } else if (rolledNumber == 2){
                    JLabel die = new JLabel();
                    img = ImageIO.read(new File("dice 2.jpg"));
                } else if (rolledNumber == 3){
                    JLabel die = new JLabel();
                    img = ImageIO.read(new File("dice 3.jpg"));
                } else if (rolledNumber == 4){
                    JLabel die = new JLabel();
                    img = ImageIO.read(new File("dice 4.jpg"));
                } else if (rolledNumber == 5){
                    JLabel die = new JLabel();
                    img = ImageIO.read(new File("dice 5.jpg"));
                } else if (rolledNumber == 6){
                    JLabel die = new JLabel();
                }
                return die; 
            }
        }
    }
}
 
    