private void initComponents() {
		UserTitle = new javax.swing.JLabel();
		Exit = new javax.swing.JButton();
		UserList = new javax.swing.JList();
		Toolbar = new javax.swing.JToolBar();
		GUITitle = new javax.swing.JLabel();
		DocumentScroll = new javax.swing.JScrollPane();
		Document = new javax.swing.JTextPane();

		setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
		setTitle("Editr | Document " + clientID);
		setBackground(new java.awt.Color(204, 255, 204));
		setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));
		setName("editr");
		setResizable(false);

		// Create the text pane and configure it.
		textPane = new JTextPane();
		textPane.setCaretPosition(0);
		StyledDocument styledDoc = textPane.getStyledDocument();
		if (styledDoc instanceof AbstractDocument) {
			doc = (AbstractDocument) styledDoc;
		} else {
			System.err
					.println("Text pane's document isn't an AbstractDocument!");
			System.exit(-1);
		}

		UserTitle.setText("Signed in as " + username);

		UserList.setBorder(javax.swing.BorderFactory.createEtchedBorder());
		UserList.setModel(new javax.swing.AbstractListModel() {
			String[] strings = { "Andrew", "Erica", "Connie" };

			public int getSize() {
				return strings.length;
			}

			public Object getElementAt(int i) {
				return strings[i];
			}
		});

		Toolbar.setRollover(true);
		Toolbar.setFloatable(false);

		GUITitle.setFont(new java.awt.Font("Tahoma", 0, 36)); // NOI18N
		GUITitle.setForeground(new java.awt.Color(51, 51, 51));
		GUITitle.setText("editr");

		Document.setBorder(javax.swing.BorderFactory.createEtchedBorder());
		Document.setCursor(new java.awt.Cursor(java.awt.Cursor.TEXT_CURSOR));
		// Document.setWrapStyleWord(true);
		// Document.setLineWrap(true);

		DocumentScroll.setViewportView(Document);

		// Set up the menu bar.
		actions = createActionTable(textPane);
		JMenu editMenu = createEditMenu();
		JMenu styleMenu = createStyleMenu();
		JMenuBar mb = new JMenuBar();
		mb.add(editMenu);
		mb.add(styleMenu);
		setJMenuBar(mb);

		// Add some key bindings.
		addBindings();

		// Start watching for undoable edits and caret changes.
		doc.addUndoableEditListener(new MyUndoableEditListener());
		doc.addDocumentListener(new MyDocumentListener());


		Document.addKeyListener(new KeyListener() {

			public void keyPressed(KeyEvent e) {
		         if (e.getKeyCode() == KeyEvent.VK_ENTER) {
		                System.out.println("ENTER");
		                insertToClient("\u0015", Document.getCaretPosition(), 0);
		            } 
		         else if (e.getKeyCode() == KeyEvent.VK_BACK_SPACE) {
		                deleteToClient("",Document.getCaretPosition()-1, 1);
		            }
		         
		         else if (e.getKeyCode() == KeyEvent.VK_LEFT || 
		                 e.getKeyCode() == KeyEvent.VK_RIGHT || 
		                 e.getKeyCode() == KeyEvent.VK_UP ||
		                 e.getKeyCode() == KeyEvent.VK_DOWN ||
		                 e.getKeyCode() == KeyEvent.VK_SHIFT ||
		                 e.getKeyCode() == KeyEvent.VK_CAPS_LOCK){

		         }
			
			    else {
			        insertToClient(((Character) e.getKeyChar()).toString(),Document.getCaretPosition(),0);
			        
		         }
			}

			public void keyTyped(KeyEvent e) {

			}

			public void keyReleased(KeyEvent e) {
			}
		});

		// Document.getDocument().addDocumentListener(documentListener);

		javax.swing.GroupLayout layout = new javax.swing.GroupLayout(
				getContentPane());
		getContentPane().setLayout(layout);
		layout.setHorizontalGroup(layout
				.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
				.addGroup(
						layout.createSequentialGroup()
								.addContainerGap()
								.addGroup(
										layout.createParallelGroup(
												javax.swing.GroupLayout.Alignment.LEADING)
												.addGroup(
														layout.createSequentialGroup()
																.addComponent(
																		DocumentScroll,
																		javax.swing.GroupLayout.PREFERRED_SIZE,
																		527,
																		javax.swing.GroupLayout.PREFERRED_SIZE)
																.addGroup(
																		layout.createParallelGroup(
																				javax.swing.GroupLayout.Alignment.LEADING)
																				.addGroup(
																						layout.createSequentialGroup()
																								.addGap(28,
																										28,
																										28)
																								.addComponent(
																										UserTitle)
																								.addGap(0,
																										0,
																										Short.MAX_VALUE))
																				.addGroup(
																						layout.createSequentialGroup()
																								.addPreferredGap(
																										javax.swing.LayoutStyle.ComponentPlacement.RELATED)
																								.addGroup(
																										layout.createParallelGroup(
																												javax.swing.GroupLayout.Alignment.LEADING)
																												.addComponent(
																														UserList,
																														javax.swing.GroupLayout.DEFAULT_SIZE,
																														javax.swing.GroupLayout.DEFAULT_SIZE,
																														Short.MAX_VALUE)
																												.addComponent(
																														Exit,
																														javax.swing.GroupLayout.DEFAULT_SIZE,
																														javax.swing.GroupLayout.DEFAULT_SIZE,
																														Short.MAX_VALUE)))))
												.addGroup(
														layout.createSequentialGroup()
																.addComponent(
																		Toolbar,
																		javax.swing.GroupLayout.PREFERRED_SIZE,
																		527,
																		javax.swing.GroupLayout.PREFERRED_SIZE)
																.addPreferredGap(
																		javax.swing.LayoutStyle.ComponentPlacement.RELATED,
																		javax.swing.GroupLayout.DEFAULT_SIZE,
																		Short.MAX_VALUE)
																.addComponent(
																		GUITitle)))
								.addContainerGap()));
		layout.setVerticalGroup(layout
				.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
				.addGroup(
						javax.swing.GroupLayout.Alignment.TRAILING,
						layout.createSequentialGroup()
								.addContainerGap()
								.addGroup(
										layout.createParallelGroup(
												javax.swing.GroupLayout.Alignment.LEADING)
												.addGroup(
														layout.createSequentialGroup()
																.addComponent(
																		GUITitle)
																.addPreferredGap(
																		javax.swing.LayoutStyle.ComponentPlacement.RELATED,
																		15,
																		Short.MAX_VALUE)
																.addComponent(
																		UserTitle)
																.addPreferredGap(
																		javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
																.addComponent(
																		UserList,
																		javax.swing.GroupLayout.PREFERRED_SIZE,
																		98,
																		javax.swing.GroupLayout.PREFERRED_SIZE)
																.addGap(231,
																		231,
																		231)
																.addComponent(
																		Exit))
												.addGroup(
														layout.createSequentialGroup()
																.addComponent(
																		Toolbar,
																		javax.swing.GroupLayout.PREFERRED_SIZE,
																		25,
																		javax.swing.GroupLayout.PREFERRED_SIZE)
																.addPreferredGap(
																		javax.swing.LayoutStyle.ComponentPlacement.RELATED)
																.addComponent(
																		DocumentScroll)))
								.addContainerGap()));

		// Set up the menu bar.
		actions = createActionTable(textPane);
		mb.add(editMenu);
		mb.add(styleMenu);
		setJMenuBar(mb);

		// Add some key bindings.
		addBindings();

		// Put the initial text into the text pane.
		textPane.setCaretPosition(0);

		// Start watching for undoable edits and caret changes.
		doc.addUndoableEditListener(new MyUndoableEditListener());
		doc.addDocumentListener(new MyDocumentListener());

		pack();
	}