summaryrefslogtreecommitdiffstats
path: root/src/jrummikub/view/impl/View.java
blob: 4e38a56f30eec0919ebbcfba6946a094e9516917 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
package jrummikub.view.impl;

import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Dimension;
import java.util.Collection;

import javax.swing.JFrame;

import jrummikub.model.Stone;
import jrummikub.view.IPlayerPanel;
import jrummikub.view.ITable;
import jrummikub.view.IView;

@SuppressWarnings("serial")
public class View extends JFrame implements IView {
  private Table table;
  private PlayerPanel playerPanel;
  
  private final static int PLAYER_PANEL_HEIGHT = 150;
  
  
  public ITable getTable() {
    return table;
  }

  public IPlayerPanel getPlayerPanel() {
    return playerPanel;
  }

  
  public View() {
    super("JRummikub");
    
    setSize(1000, 700);
    setDefaultCloseOperation(EXIT_ON_CLOSE);
    
    setLayout(new BorderLayout());
    
    table = new Table();
    add(table, BorderLayout.CENTER);

    playerPanel = new PlayerPanel();
    playerPanel.setBorder(new CustomBorder(Color.BLACK, 1, 0, 0, 0));
    playerPanel.setPreferredSize(new Dimension(0, PLAYER_PANEL_HEIGHT+1));
    add(playerPanel, BorderLayout.SOUTH);
    
    setVisible(true);
  }

  @Override
  public void setSelectedStones(Collection<Stone> stones) {
    table.setSelectedStones(stones);
    playerPanel.getBoard().setSelectedStones(stones);
  }
}