public void initComponents() {

		UIManager.put("TextArea.margin", new Insets(10, 10, 10, 10));
		jPanel = new JPanel();
		jScrollPane1 = new JScrollPane();
		output = new JTextArea();
		jScrollPane2 = new JScrollPane();
		input = new JTextArea();
		font = new Font(Font.SANS_SERIF, Font.PLAIN, 20);
		undo = new UndoManager();

		setTitle("PinyinExtensibleEditor");
		setSize(800, 500);
		setVisible(true);
		setResizable(false);
		setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

		output.setColumns(20);
		output.setEditable(false);
		DefaultCaret caret = (DefaultCaret)output.getCaret();
		caret.setUpdatePolicy(DefaultCaret.ALWAYS_UPDATE);
		output.addMouseListener(new MouseListener() {
			/* (non-Javadoc)
			 * @see java.awt.event.MouseListener#mouseClicked(java.awt.event.MouseEvent)
			 */
			@Override
			public void mouseClicked(MouseEvent event) {
				String text = output.getText();
				StringSelection stringSelection = new StringSelection(text);
				Clipboard clpbrd = Toolkit.getDefaultToolkit()
						.getSystemClipboard();
				clpbrd.setContents(stringSelection, null);
			}

			/* (non-Javadoc)
			 * @see java.awt.event.MouseListener#mousePressed(java.awt.event.MouseEvent)
			 */
			@Override
			public void mousePressed(MouseEvent event) {

			}

			/* (non-Javadoc)
			 * @see java.awt.event.MouseListener#mouseReleased(java.awt.event.MouseEvent)
			 */
			@Override
			public void mouseReleased(MouseEvent event) {

			}

			/* (non-Javadoc)
			 * @see java.awt.event.MouseListener#mouseEntered(java.awt.event.MouseEvent)
			 */
			@Override
			public void mouseEntered(MouseEvent event) {

			}

			/* (non-Javadoc)
			 * @see java.awt.event.MouseListener#mouseExited(java.awt.event.MouseEvent)
			 */
			@Override
			public void mouseExited(MouseEvent event) {

			}
		});
		output.setFont(font);
		jScrollPane1.setViewportView(output);

		input.setColumns(20);
		input.setFont(font);
		jScrollPane2.setViewportView(input);
		
		Document doc = input.getDocument();
		doc.addUndoableEditListener(new UndoableEditListener() {
		    /* (non-Javadoc)
		     * @see javax.swing.event.UndoableEditListener#undoableEditHappened(javax.swing.event.UndoableEditEvent)
		     */
		    @Override
		    public void undoableEditHappened(UndoableEditEvent event) {
		        undo.addEdit(event.getEdit());
		    }
		});

		InputMap inputMap = input.getInputMap(JComponent.WHEN_FOCUSED);
		ActionMap actionMap = input.getActionMap();

		inputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_Z, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask()), "Undo");
		inputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_Y, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask()), "Redo");

		actionMap.put("Undo", new AbstractAction() {

			private static final long serialVersionUID = -6423096995199182203L;

			/* (non-Javadoc)
			 * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
			 */
			@Override
			public void actionPerformed(ActionEvent event) {
				try {
		            if (undo.canUndo()) {
		                undo.undo();
		            }
		        } catch (CannotUndoException exp) {
		            exp.printStackTrace();
		        }
				
			}
		});
		actionMap.put("Redo", new AbstractAction() {

			private static final long serialVersionUID = -899655610183011824L;

			/* (non-Javadoc)
			 * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
			 */
			@Override
		    public void actionPerformed(ActionEvent event) {
		        try {
		            if (undo.canRedo()) {
		                undo.redo();
		            }
		        } catch (CannotUndoException exp) {
		            exp.printStackTrace();
		        }
		    }
		});

		GroupLayout jPanelLayout = new GroupLayout(jPanel);
		jPanel.setLayout(jPanelLayout);
		jPanelLayout.setHorizontalGroup(jPanelLayout
				.createParallelGroup(Alignment.LEADING)
				.addComponent(jScrollPane1, GroupLayout.DEFAULT_SIZE, 700,
						Short.MAX_VALUE)
				.addGroup(
						jPanelLayout.createParallelGroup(Alignment.LEADING)
								.addComponent(jScrollPane2)));
		jPanelLayout
				.setVerticalGroup(jPanelLayout
						.createParallelGroup(Alignment.LEADING)
						.addGroup(
								Alignment.TRAILING,
								jPanelLayout
										.createSequentialGroup()
										.addGap(225, 225, 225)
										.addComponent(jScrollPane1,
												GroupLayout.PREFERRED_SIZE,
												200, GroupLayout.PREFERRED_SIZE)
										.addGap(25, 25, 25))
						.addGroup(
								jPanelLayout
										.createParallelGroup(Alignment.LEADING)
										.addGroup(
												jPanelLayout
														.createSequentialGroup()
														.addGap(25, 25, 25)
														.addComponent(
																jScrollPane2,
																GroupLayout.PREFERRED_SIZE,
																200,
																GroupLayout.PREFERRED_SIZE))));

		GroupLayout layout = new GroupLayout(getContentPane());
		getContentPane().setLayout(layout);
		layout.setHorizontalGroup(layout.createParallelGroup().addComponent(
				jPanel));
		layout.setVerticalGroup(layout.createParallelGroup().addComponent(
				jPanel));

		input.setLineWrap(true);
		output.setLineWrap(true);
		jScrollPane1
				.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
		jScrollPane2
				.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
		pack();
	}