summaryrefslogtreecommitdiffstats
path: root/src/jrummikub/JRummikub.java
blob: 552ca8f76fc45627dda774d5d82f752f8ac2f712 (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
57
58
59
60
61
62
63
64
65
package jrummikub;

import java.util.HashMap;
import java.util.Map;

import javax.swing.UIManager;

import jrummikub.model.Position;
import jrummikub.model.Stone;
import jrummikub.model.StoneColor;
import jrummikub.util.IListener;
import jrummikub.view.IView;

public class JRummikub {

  /**
   * @param args
   */
  public static void main(String[] args) {
    String nativeLF = UIManager.getSystemLookAndFeelClassName();

    try {
      UIManager.setLookAndFeel(nativeLF);
    } catch (Exception e) {
    }
    
    IView view = new jrummikub.view.impl.View();
    
    view.getPlayerPanel().setCurrentPlayerName("Player 1");
    view.getPlayerPanel().setTimeLeft(42);
    view.getTable().setLeftPlayerName("Player 2");
    view.getTable().setTopPlayerName("Player 3");
    view.getTable().setRightPlayerName("Player 4");
    
    view.getPlayerPanel().getSortByNumberEvent().add(new IListener() {
      @Override
      public void fire() {
        System.out.println("'Sort by number' fired");
      }});
    view.getPlayerPanel().getSortByColorEvent().add(new IListener() {
      @Override
      public void fire() {
        System.out.println("'Sort by color' fired");
      }});
    view.getPlayerPanel().getEndTurnEvent().add(new IListener() {
      @Override
      public void fire() {
        System.out.println("'End turn' fired");
      }});
    
    Map<Stone, Position> stones = new HashMap<Stone, Position>();
    stones.put(new Stone(1, StoneColor.ORANGE, false), new Position(0, 0));
    stones.put(new Stone(10, StoneColor.BLUE, false), new Position(1, 0));
    stones.put(new Stone(9, StoneColor.RED, false), new Position(0.5f, 1));
    stones.put(new Stone(7, StoneColor.BLACK, false), new Position(1.75f, 1));
    
    stones.put(new Stone(0, StoneColor.RED, true), new Position(2.5f, 0));
    stones.put(new Stone(0, StoneColor.BLACK, true), new Position(3.5f, 0));

    view.getPlayerPanel().getBoard().setStones(stones);

    
  }

}