From c348da2de20a486f1e02840b181478dabb727447 Mon Sep 17 00:00:00 2001 From: joachimschmidt557 Date: Tue, 26 Mar 2019 17:48:35 +0100 Subject: [PATCH] Javadoc for JokerPanel --- .../src/gui/components/JokerPanel.java | 33 +++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/Projektgruppe_175/src/gui/components/JokerPanel.java b/Projektgruppe_175/src/gui/components/JokerPanel.java index 9de9ec6..3ff5bbf 100644 --- a/Projektgruppe_175/src/gui/components/JokerPanel.java +++ b/Projektgruppe_175/src/gui/components/JokerPanel.java @@ -30,6 +30,11 @@ public class JokerPanel extends JPanel implements MouseListener{ private JokerTypes[] jokers; + /** + * Constructs a new joker panel + * @param resources The resources + * @param game The corresponding game + */ public JokerPanel(Resources resources, Game game) { this.game = game; this.resources = resources; @@ -37,26 +42,50 @@ public class JokerPanel extends JPanel implements MouseListener{ initJokers(); } + /** + * Initializes the jokers + */ private void initJokers() { jokers = new JokerTypes[]{JokerTypes.ADD_TROOPS, JokerTypes.SCARE_TROOPS }; } + /** + * Associates with a game view + * @param gv The game view + */ public void setGameView(GameView gv) { this.gv = gv; } + /** + * Associates with a game + * @param game The game + */ public void setGame(Game game) { this.game = game; } + /** + * Associates with a map panel + * @param map The map panel + */ public void setMapPanel(MapPanel map) { this.map = map; } + /** + * Modifies the joker at this index + * @param index The index + * @param j The new joker + */ private void setJoker(int index, JokerTypes j) { jokers[index] = j; } + /** + * Plays the joker at this index + * @param index The index + */ public void playJoker(int index) { if(game.getRound() < 2) return; @@ -99,6 +128,10 @@ public class JokerPanel extends JPanel implements MouseListener{ paintJokers(g); } + /** + * Paints the jokers + * @param g The graphics to paint on + */ public void paintJokers(Graphics g) { if(jokers == null) return;