private void initComponents(String mapFormat) {

	    setDefaultCloseOperation(EXIT_ON_CLOSE);
	    setTitle("IJA 2014 - Bludiště");

	    getContentPane().setLayout(new BorderLayout());

	    JPanel controlPane = new JPanel();

	    controlPane.setLayout(new BorderLayout());

	    map = new XMap(mapFormat);

	    history = new JTextArea(5, 20);
	    history.setEnabled(false);
	    history.setDisabledTextColor(Color.GRAY);

	    // auto-scroll na dno text arey
	    ((DefaultCaret) history.getCaret()).setUpdatePolicy(DefaultCaret.ALWAYS_UPDATE);

	    prompt = new JTextField();

	//pridej mapu
	    //getContentPane().add(map, BorderLayout.CENTER);
	    int i = 0;

	    mapScrollPane = new JScrollPane(map);

	//scrollPane.setPreferredSize(new Dimension(50, 50));
	    //mapScrollPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED);
	    //mapScrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);
	    getContentPane().add(mapScrollPane);

	    historyScrollPane = new JScrollPane(history);
	    historyScrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);
	    history.setWrapStyleWord(true);

	    controlPane.add(prompt, BorderLayout.SOUTH);

	    controlPane.add(historyScrollPane, BorderLayout.CENTER);

	    add(controlPane, BorderLayout.WEST);

	    prompt.addKeyListener(new KeyAdapter() {

		@Override
		public void keyPressed(KeyEvent e) {

		    if (e.getKeyCode() == KeyEvent.VK_ENTER) {
			String text = prompt.getText();
			enterMessage(text);

			send(text);
			
			if (text.equals("close")) {
				Workspace.this.dispatchEvent(
					new WindowEvent(Workspace.this, WindowEvent.WINDOW_CLOSING)
				);
			}
			
		    } //temporary
		    else if (e.getKeyCode() == KeyEvent.VK_UP) {
			enterMessage("step");
			send("step");
		    } else if (e.getKeyCode() == KeyEvent.VK_LEFT) {
			enterMessage("left");
			send("left");
		    } else if (e.getKeyCode() == KeyEvent.VK_RIGHT) {
			enterMessage("right");
			send("right");
		    } else if (e.getKeyCode() == KeyEvent.VK_SPACE) {
			enterMessage("open");
			send("open");
		    } else if (e.getKeyCode() == KeyEvent.VK_DOWN) {
			enterMessage("take");
			send("take");
		    }

		}
	    }
	    );

	    this.addWindowListener(new WindowAdapter() {

		@Override
		public void windowClosing(WindowEvent e) {

		    try {
			client.close();
		    } catch (IOException ex) {
			JOptionPane.showMessageDialog(Workspace.this, ex.getMessage());
		    }
		}

	    });

	//setResizable(false);
	    pack();
	    
	    prompt.requestFocusInWindow();
	    Dimension dim = Toolkit.getDefaultToolkit().getScreenSize();
	    
	    this.setLocation(dim.width / 2 - this.getSize().width / 2, dim.height / 2 - this.getSize().height / 2);
	    
	    setVisible(true);
	    
    }