This repository has been archived on 2025-03-02. You can view files and clone it, but cannot push or open issues or pull requests.
JRummikub/src/jrummikub/JRummikub.java

66 lines
1.9 KiB
Java
Raw Normal View History

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);
}
}