JAVA. A gui that prints a dice roll
I am rolling a dice in a gui.  I am getting the number I want returned(random int 1-6) but the image I want to display is not showing up.  It shows the correct image the first time but never changes it.  Here is the code: 

    public void layoutComponents()
    {
	Container container = frame.getContentPane();
	container.setLayout(new GridLayout(1, 1));
	diceRoll.setEditable(true);
	container.add(button);
	container.add(addPanel());
	//container.add(diceRoll);
	frame.setSize(200, 200);
	frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
    }
    
    class DiceActions implements ActionListener
    {

	@Override
	public void actionPerformed(ActionEvent e)
	{
	    layoutComponents();
	    //diceRoll.append(Double.toString((int)numberRolled));
	}
	
    }
    
    public ImageIcon rollDice()
    {
	double numberRolled = (int)(Math.random() * 10 + 1);
	ImageIcon image = dice1;
	    if (numberRolled > 6)
	    {
		numberRolled -= 4;
	    }
	    if(numberRolled == 1)
	    {
		image = dice1;
		System.out.println("1");
		System.out.println(numberRolled);
		return image = dice1;
	    }
	    else if(numberRolled == 2)
	    {
		image = dice2;
		System.out.println("2");
		return image = dice2;
	    }
	    else if(numberRolled == 3)
	    {
		image = dice3;
		System.out.println("3");
		return image = dice3;
	    }
	    else if(numberRolled == 4)
	    {
		image = dice4;
		System.out.println("4");
		return image = dice4;
	    }
	    else if(numberRolled == 5)
	    {
		image = dice5;
		System.out.println("5");
		return image = dice5;
	    }
	    else if(numberRolled == 6)
	    {
		image = dice6;
		System.out.println("6");
		return image = dice6;
	    }
	    else
		System.out.println("never reached");
	    	System.out.println(numberRolled);
		return image;
    }
    
    public JPanel addPanel()
    {
	JPanel panel = new JPanel();
	panel.add(new JLabel(rollDice()));
	return panel;
    }
    
    public void addListeners()
    {
	DiceActions action = new DiceActions();
	button.addActionListener(action);
    }
JAVA. A gui that prints a dice roll
===

I am rolling a dice in a gui.  I am getting the number I want returned(random int 1-6) but the image I want to display is not showing up.  It shows the correct image the first time but never changes it.  Here is the code: 

    public void layoutComponents()
    {
	Container container = frame.getContentPane();
	container.setLayout(new GridLayout(1, 1));
	diceRoll.setEditable(true);
	container.add(button);
	container.add(addPanel());
	//container.add(diceRoll);
	frame.setSize(200, 200);
	frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
    }
    
    class DiceActions implements ActionListener
    {

	@Override
	public void actionPerformed(ActionEvent e)
	{
	    layoutComponents();
	    //diceRoll.append(Double.toString((int)numberRolled));
	}
	
    }
    
    public ImageIcon rollDice()
    {
	double numberRolled = (int)(Math.random() * 10 + 1);
	ImageIcon image = dice1;
	    if (numberRolled > 6)
	    {
		numberRolled -= 4;
	    }
	    if(numberRolled == 1)
	    {
		image = dice1;
		System.out.println("1");
		System.out.println(numberRolled);
		return image = dice1;
	    }
	    else if(numberRolled == 2)
	    {
		image = dice2;
		System.out.println("2");
		return image = dice2;
	    }
	    else if(numberRolled == 3)
	    {
		image = dice3;
		System.out.println("3");
		return image = dice3;
	    }
	    else if(numberRolled == 4)
	    {
		image = dice4;
		System.out.println("4");
		return image = dice4;
	    }
	    else if(numberRolled == 5)
	    {
		image = dice5;
		System.out.println("5");
		return image = dice5;
	    }
	    else if(numberRolled == 6)
	    {
		image = dice6;
		System.out.println("6");
		return image = dice6;
	    }
	    else
		System.out.println("never reached");
	    	System.out.println(numberRolled);
		return image;
    }
    
    public JPanel addPanel()
    {
	JPanel panel = new JPanel();
	panel.add(new JLabel(rollDice()));
	return panel;
    }
    
    public void addListeners()
    {
	DiceActions action = new DiceActions();
	button.addActionListener(action);
    }