Exemplo n.º 1
0
  private static void init() {
    if (inited) return;

    Domino dummy = new Domino(-1, -1); // Dummy object needed for resources

    images = new ImageIcon[Domino.MAX_VALUE + 1];
    for (int i = 0; i < images.length; i++)
      images[i] = new ImageIcon(dummy.getClass().getResource("/image/" + i + ".png"), "" + i);

    inited = true;
  }
Exemplo n.º 2
0
  public DominoPanel(Domino domino) {
    super();
    this.domino = domino;

    setBackground(Color.BLACK);
    setPreferredSize(new Dimension(74, 148));
    setLayout(new GridLayout(2, 1));

    JLabel left = new JLabel(images[domino.getLeft()]);
    JLabel right = new JLabel(images[domino.getRight()]);

    add(left);
    add(right);
  }