From 9ae9620d4d881a857ff3ecb16c55bf39750ea234 Mon Sep 17 00:00:00 2001
From: taskat <tamas.taska@gmx.com>
Date: Wed, 6 May 2020 22:05:28 +0200
Subject: [PATCH] Item placing corrected

---
 .../src/arctic_nightmare/Board.java           |  4 ++--
 .../src/arctic_nightmare/GameWindow.java      |  6 +----
 .../arctic_nightmare/ScaledImagePanel.java    | 22 ++-----------------
 3 files changed, 5 insertions(+), 27 deletions(-)

diff --git a/Arctic_Nigthmare/src/arctic_nightmare/Board.java b/Arctic_Nigthmare/src/arctic_nightmare/Board.java
index 16caa98..824ac9d 100644
--- a/Arctic_Nigthmare/src/arctic_nightmare/Board.java
+++ b/Arctic_Nigthmare/src/arctic_nightmare/Board.java
@@ -47,7 +47,7 @@ public class Board {
     	//place essential objects on stable fields
     	while(essentials.size() != 0){
     		int idx = rnd.nextInt(fields.size());
-    		if(fields.get(idx).getCapacity() == 10 && fields.get(idx).getItem() == null){
+    		if(fields.get(idx).getCapacity() == 10 && fields.get(idx).item == null){
     			fields.get(idx).addItem(essentials.get(0));
     			essentials.remove(0);
     		}
@@ -55,7 +55,7 @@ public class Board {
     	//place other items to remaining fields
     	while(otheritems.size() != 0){
     		int idx = rnd.nextInt(fields.size());
-    		if(fields.get(idx).getCapacity() != 0 && fields.get(idx).getItem() == null){
+    		if(fields.get(idx).getCapacity() != 0 && fields.get(idx).item == null){
     			fields.get(idx).addItem(otheritems.get(0));
     			otheritems.remove(0);
     		}
diff --git a/Arctic_Nigthmare/src/arctic_nightmare/GameWindow.java b/Arctic_Nigthmare/src/arctic_nightmare/GameWindow.java
index cf38d24..2b9d7f8 100644
--- a/Arctic_Nigthmare/src/arctic_nightmare/GameWindow.java
+++ b/Arctic_Nigthmare/src/arctic_nightmare/GameWindow.java
@@ -185,10 +185,8 @@ public class GameWindow extends JFrame{
         UI.put("Panel.background", Color.white);        
         String[] size = {"4", "5", "6", "7"};
         String[] players = {"2", "3", "4", "5", "6"};
-        String[] difficulty = {"CakeWalk", "Saturdy afternoon", "Sure?", "You are kidding!", "White hell"};
         JComboBox<String> combo = new JComboBox<>(size);
         JComboBox<String> combo1 = new JComboBox<>(players);
-        JComboBox<String> combo2 = new JComboBox<>(difficulty);
         JPanel panel0 = new JPanel(new FlowLayout());
         JPanel panel = new JPanel(new GridLayout(0, 1));
         JLabel bear = new JLabel(new ImageIcon("src/arctic_nightmare/resources/icebear.gif"));
@@ -197,12 +195,10 @@ public class GameWindow extends JFrame{
         panel.add(combo);
         panel.add(new JLabel("Players :"));
         panel.add(combo1);
-        panel.add(new JLabel("Difficulty :"));
-        panel.add(combo2);
         panel0.add(panel);
         panel0.add(bear);
         int result = JOptionPane.showConfirmDialog(null, panel0, "Game options", JOptionPane.DEFAULT_OPTION, JOptionPane.PLAIN_MESSAGE);
-        return new Object[]{combo.getSelectedItem(), combo1.getSelectedItem(), combo2.getSelectedItem()};
+        return new Object[]{combo.getSelectedItem(), combo1.getSelectedItem()};
     } 
     
     static public String getPlayerOptions(int count)
diff --git a/Arctic_Nigthmare/src/arctic_nightmare/ScaledImagePanel.java b/Arctic_Nigthmare/src/arctic_nightmare/ScaledImagePanel.java
index 4eb0853..dd35d76 100644
--- a/Arctic_Nigthmare/src/arctic_nightmare/ScaledImagePanel.java
+++ b/Arctic_Nigthmare/src/arctic_nightmare/ScaledImagePanel.java
@@ -5,32 +5,19 @@
  */
 package arctic_nightmare;
 
-import java.awt.image.BufferedImage;
-import java.io.File;
-import java.io.IOException;
-import javax.imageio.ImageIO;
 import javax.swing.ImageIcon;
 import javax.swing.JFrame;
 import javax.swing.JLabel;
 
-/**
- *
- * @author csellar
- */
+
 public class ScaledImagePanel extends JLabel{
  
-    private BufferedImage image;
-
+    
     public ScaledImagePanel(JFrame window, String file, int x, int y, int width, int height) {
         super(new ImageIcon(GameWindow.getScaledImage((new ImageIcon(file)).getImage(), width, height)));
         setBounds(x, y, width, height);
         setVisible(true);
         window.add(this);
-       try {                
-          image = ImageIO.read(new File("/src/arctic_nightmare/resources/divingsuit_visible.png"));          
-       } catch (IOException ex) {
-           System.out.print("No picture : " + ex.toString());
-       }
     }
     
     public ScaledImagePanel(JFrame window, ImageIcon picture, int x, int y, int width, int height) {
@@ -38,11 +25,6 @@ public class ScaledImagePanel extends JLabel{
         setBounds(x, y, width, height);
         setVisible(true);
         window.add(this);
-       try {                
-          image = ImageIO.read(new File("/src/arctic_nightmare/resources/divingsuit_visible.png"));          
-       } catch (IOException ex) {
-           System.out.print("No picture : " + ex.toString());
-       }
     }
     
     void remove()
-- 
GitLab