public void displayContextPanelWithTileInfo(int x, int y) {
    	contextPanel.setVisible(false);
        ((JPanel) contextPanel.getComponent(0)).removeAll();

        int tileX = x / this.tileSize;
        int tileY = y / this.tileSize;

        //klikniety tile tła
        JLabel clickedTile = this.backgroundTileGrid.get(tileY).get(tileX);
        
        int tileNum = getTileIDFromColor(clickedTile);
        
        contextPanel.setBounds(this.contextPanelDefaultRect);
        Rectangle rect = new Rectangle(x, y, contextPanel.getWidth(), contextPanel.getHeight());
        if (rect.y > this.getContentPane().getHeight() - rect.height) {
            rect.y -= rect.height;
        }
        if (rect.x > this.getContentPane().getWidth() - rect.width) {
            rect.x -= rect.width;
        }
        contextPanel.setBounds(rect);
        
        JLabel iconForContextPanel = tileFromNumber(tileNum);

        iconForContextPanel.setHorizontalAlignment(JLabel.CENTER);
        iconForContextPanel.setVerticalAlignment(JLabel.CENTER);

        ((JPanel) contextPanel.getComponent(0)).add(iconForContextPanel);

        //klikniety tile pierwszego planu
        JLabel clickedFgTile = this.foregroundTileGrid.get(tileY).get(tileX);
        
        
        int tileFgNum = -1;
        //jesli klikniety tile jest typu TilesLabel to wtedy pobiramy liste obiektow, ktore tam sa
        //i wyswietlamy o nich informacje
        JLabel iconFgForContextPanel = new JLabel(clickedFgTile.getIcon());
        if (!(clickedFgTile instanceof TilesLabel)) {
        	 tileFgNum = getTileIDFromColor(clickedFgTile);
             iconFgForContextPanel = tileFromNumber(tileFgNum);
        } else {
        	if (((TilesLabel)clickedFgTile).getForegroundObjects().size() == 1) {
        		tileFgNum = ((TilesLabel)clickedFgTile).getForegroundObjects().get(0).tile.getBackground().getRGB() & 0xFFFFFF;
        	}
        }
        
        iconFgForContextPanel.setHorizontalAlignment(JLabel.CENTER);
        iconFgForContextPanel.setVerticalAlignment(JLabel.CENTER);
        ((JPanel) contextPanel.getComponent(0)).add(iconFgForContextPanel);

        JLabel opisIkony;
        opisIkony = new JLabel("<html><h3>Informacje o polu</h3></html>");
        opisIkony.setBorder(new EmptyBorder(0, 8, 0, 0));

        iconDisplayPanel.add(opisIkony);

        StringBuilder sb = new StringBuilder("<html>");
        sb.append("Kliknięte pole: <pre>X: <b>").append(tileX).append("</b> Y: <b>").append(tileY).append("</b></pre>");
        sb.append("<br/> ");
        sb.append("Warstwa obiektów:<br/>");
        
        if (!(clickedFgTile instanceof TilesLabel)) {
        	sb.append(tileFgNum).append(": <b>").append(InformacjeOSwiecie.getOpisKafelka(tileFgNum)).append("</b>");
        } else {
        	sb.append(tileFgNum).append(": <b>").append(((TilesLabel)clickedFgTile).getDescription()).append("</b>");
        }
        
        
        sb.append("<br/>Warstwa tła:<br/>");
        sb.append(tileNum).append(": <b>").append(InformacjeOSwiecie.getOpisKafelka(tileNum)).append("</b>");
        sb.append("</html>");

        tileInfoPanelLabel1.setText(sb.toString());
        contextPanel.setVisible(true);
    }