private void initializeListeners() {
		
		addMouseListener(new MouseAdapter() {
			@Override
		    public void mousePressed(MouseEvent e) {
				posX=e.getX();
				posY=e.getY();
			}
			@Override
			public void mouseReleased(MouseEvent e) {
				repaint();
			}
		});
		
		addMouseMotionListener(new MouseAdapter() {
			@Override
			public void mouseDragged(MouseEvent evt) {		
				setLocation(evt.getXOnScreen()-posX,evt.getYOnScreen()-posY);
			}
		});		
		
		input.addActionListener(new ActionListener() {
			@Override
			public void actionPerformed(ActionEvent arg0) {
				String cmd = input.getText();
				int size = commandHistory.size();
				parse(cmd);
				commandHistory.add(size-1,cmd);
				historyIndex = size;
				input.setText("");
			}
		});
		
		input.addKeyListener(new KeyAdapter() {
			@Override
			public void keyPressed(KeyEvent e) {
				
				if (!commandHistory.isEmpty()) {
					if (e.getKeyCode() == KeyEvent.VK_UP) {
						if (historyIndex > 0) {
							historyIndex--;
							String cmd = commandHistory.get(historyIndex);
							input.setText(cmd);
						} else {
							input.setText("");
						}

					} else if (e.getKeyCode() == KeyEvent.VK_DOWN) {
						if (historyIndex < commandHistory.size()-1) {
							historyIndex++;
							String cmd = commandHistory.get(historyIndex);
							input.setText(cmd);
						} else {
							input.setText("");
						}

					}
				}
			}
		});
		
		MouseAdapter exitBorderRepaint = new MouseAdapter() {
			@Override
			public void mouseExited(MouseEvent arg0) {
				repaint(0,0,getWidth(),1);
			}
		};
		
		menuFile.addMouseListener(exitBorderRepaint);
		menuEdit.addMouseListener(exitBorderRepaint);
		menuHelp.addMouseListener(exitBorderRepaint);
		
		menuItemLeetMode.addActionListener(new ActionListener() {
			@Override
			public void actionPerformed(ActionEvent e) {
				if (!isLeetMode) {
					output.setBackground(new Color(0, 0, 0));
					output.setForeground(new Color(0,255,0));
				} else {
					output.setBackground(new Color(255,255,255));
					output.setForeground(new Color(0,0,0));
				}
				isLeetMode = !isLeetMode;
				repaint(0,0,getWidth(),1);
			}
		});
		
		menuItemClearOutput.addActionListener(new ActionListener() {
			@Override
			public void actionPerformed(ActionEvent e) {
				output.setText("");
				repaint(0,0,getWidth(),1);
			}
		});
		
        addWindowListener(new java.awt.event.WindowAdapter() {
            public void windowClosing(java.awt.event.WindowEvent e) {
            	setState(Frame.ICONIFIED);
            }
        });
	}