public void changeRoom(Room nextRoom)
    {
        String imagePath = nextRoom.getRoomImagePath();
        String charImagePath;
        String itemImagePath;
        //remove all from the mainpanel
        mainpanel.removeAll();
        mainpanel.setLayout(null);
        
        
        //draw the characters if exist
        if (nextRoom.getRoomChar() != null && nextRoom.getRoomChar().isAlive() == true)
        {
            Character roomChar = nextRoom.getRoomChar();  //get room char
            charImagePath = roomChar.getCharImagePath(); //get room char path
            
            //draw the character and add it to the panel
            charIcon = new ImageIcon(getClass().getResource(charImagePath));
            //Set the corresponding ImageIcon and set if the label is visible
            //name is used as identifier
            setIconPositionAndVisibility(roomChar.getName(), charIcon, true);
        }
        
        //draw the items if exist any
        if (!nextRoom.getItems().isEmpty())
        {
            HashSet<Item> items = nextRoom.getItems();
            
            for (Item itemToDisplay : items)
            {
                itemImagePath = itemToDisplay.getItemURL();
                itemIcon = new ImageIcon(getClass().getResource(itemImagePath));
                if (itemToDisplay.getName().equals("keys"))
                {
                    setIconPositionAndVisibility(itemToDisplay.getName(), itemIcon, true);
                }
                else if (itemToDisplay.getName().equals("bat"))
                {
                    setIconPositionAndVisibility(itemToDisplay.getName(), itemIcon, true);
                }
                else if (itemToDisplay.getName().equals("sword"))
                {
                    setIconPositionAndVisibility(itemToDisplay.getName(), itemIcon, true);
                }
                else if (itemToDisplay.getName().equals("book"))
                {
                    setIconPositionAndVisibility(itemToDisplay.getName(), itemIcon, true);
                }
                else if (itemToDisplay.getName().equals("chest"))
                {
                    setIconPositionAndVisibility(itemToDisplay.getName(), itemIcon, false);
                }
                
            }
            
        }

        mainpanel.setImagePath(imagePath);
        pack();
    }