diff --git a/Projektgruppe_175/src/gui/views/GameView.java b/Projektgruppe_175/src/gui/views/GameView.java index 79e0746..46b4ac1 100644 --- a/Projektgruppe_175/src/gui/views/GameView.java +++ b/Projektgruppe_175/src/gui/views/GameView.java @@ -22,6 +22,9 @@ import gui.components.MapPanel; public class GameView extends View implements GameInterface { + private final int JOKER_PANEL_HEIGHT = 50; + + private MapPanel map; private JScrollPane scrollLog; private JTextPane txtStats; @@ -29,12 +32,17 @@ public class GameView extends View implements GameInterface { private JTextPane gameLog; private JButton button; private Game game; + + private JokerPanel jokers; GameView(GameWindow gameWindow, Game game) { super(gameWindow); this.game = game; + jokers.setGame(game); + jokers.setGameView(this); } + private int sidebarWidth() { return (int) Math.max(getWidth() * 0.15, 300); } @@ -42,7 +50,7 @@ public class GameView extends View implements GameInterface { private Dimension mapPanelSize() { int w = getWidth(); int h = getHeight(); - return new Dimension(w - sidebarWidth() - 40, h - 20); + return new Dimension(w - sidebarWidth() - 40, h - 20 - JOKER_PANEL_HEIGHT); } @Override @@ -53,13 +61,19 @@ public class GameView extends View implements GameInterface { int sidebarWidth = sidebarWidth(); Dimension mapPanelSize = mapPanelSize(); - this.map.setBounds(10, 10, mapPanelSize.width, mapPanelSize.height); + this.map.setBounds(10, JOKER_PANEL_HEIGHT + 10, mapPanelSize.width, mapPanelSize.height); this.map.revalidate(); this.map.repaint(); int x = w - sidebarWidth - 20; int y = 10; - + + jokers.setSize(mapPanelSize.width, JOKER_PANEL_HEIGHT); + jokers.setBounds(10, y, mapPanelSize.width, JOKER_PANEL_HEIGHT - 10); + + jokers.revalidate(); + jokers.repaint(); + txtStats.setSize(sidebarWidth, 50 + 20 * game.getPlayers().size()); dices.setSize(sidebarWidth, 50); scrollLog.setSize(sidebarWidth, h - txtStats.getHeight() - dices.getHeight() - 50 - BUTTON_SIZE.height); @@ -87,6 +101,9 @@ public class GameView extends View implements GameInterface { this.dices = new DicePanel(getWindow().getResources()); this.dices.setBorder(new LineBorder(Color.BLACK)); this.add(dices); + this.jokers = new JokerPanel(getWindow().getResources(), game); + this.jokers.setBorder(new LineBorder(Color.BLACK)); + this.add(jokers); this.gameLog = createTextPane(); this.gameLog.addStyle("PlayerColor", null); this.scrollLog = new JScrollPane(gameLog);