diff --git a/src/main/java/armameeldoparti/controllers/SkillPointsInputController.java b/src/main/java/armameeldoparti/controllers/SkillPointsInputController.java index 8cc25f7..55533e0 100644 --- a/src/main/java/armameeldoparti/controllers/SkillPointsInputController.java +++ b/src/main/java/armameeldoparti/controllers/SkillPointsInputController.java @@ -1,15 +1,12 @@ package armameeldoparti.controllers; -import armameeldoparti.models.Player; +import java.util.Arrays; import armameeldoparti.models.Position; import armameeldoparti.models.ProgramView; import armameeldoparti.utils.common.CommonFields; import armameeldoparti.utils.common.CommonFunctions; import armameeldoparti.utils.common.Constants; import armameeldoparti.views.SkillPointsInputView; -import java.util.Map; -import javax.swing.JLabel; -import javax.swing.JSpinner; /** * Skill points input view controller class. @@ -73,16 +70,13 @@ public void backButtonEvent() { * Updates the players name labels. */ public void updateNameLabels() { - Map labelsMap = view.getLabelsMap(); - Map spinnersMap = view.getSpinnersMap(); - - for (Position position : Position.values()) { - for (Player player : CommonFields.getPlayersSets() - .get(position)) { - labelsMap.get(spinnersMap.get(player)) - .setText(player.getName()); - } - } + Arrays.asList(Position.values()) + .forEach(position -> CommonFields.getPlayersSets() + .get(position) + .forEach(player -> view.getLabelsMap() + .get(view.getSpinnersMap() + .get(player)) + .setText(player.getName()))); view.pack(); } @@ -103,10 +97,8 @@ protected void setUpInitialState() { protected void setUpListeners() { view.getBackButton() .addActionListener(e -> backButtonEvent()); - view.getFinishButton() .addActionListener(e -> finishButtonEvent()); - view.getResetSkillPointsButton() .addActionListener(e -> resetSkillPointsButtonEvent()); }