import java.awt.*;
import javax.swing.*;

/** 
 * Displays a set of Dice as pokerdice
 */
public class PokerDice  extends JFrame {   
   /**
    * Opens a window and displays a number of dice
    * with poker faces
    * @param dice the set of dice
    */
   public PokerDice(Dice[] dice) {
      ImageIcon[] icons = new ImageIcon[6];
      icons[0] = new ImageIcon("images/Die9.png");
      icons[1] = new ImageIcon("images/Die10.png");
      icons[2] = new ImageIcon("images/DieJack.png");
      icons[3] = new ImageIcon("images/DieQueen.png");
      icons[4] = new ImageIcon("images/DieKing.png");
      icons[5] = new ImageIcon("images/DieAce.png");

      for (Dice d: dice) {
         add(new JLabel(icons[d.getValue()-1]));  
      }
      setLayout(new FlowLayout());
      setPreferredSize(new Dimension(630, 440));
      pack();
      setDefaultCloseOperation(EXIT_ON_CLOSE);
      setVisible(true);
   }
   
   
   public static void main(String[] args) {
      Dice[] poker = new Dice[5];
      for (int i=0; i<5; i++) {
         poker[i] = new Dice();
      }
      new PokerDice(poker);
   }
}