public JavaConsole()
    {
        // create all components and add them
        frame = new JFrame("Java Console");
        Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
        Dimension frameSize = new Dimension((int) (screenSize.width / 2), (int) (screenSize.height / 2));
        int x = (int) (frameSize.width / 2);
        int y = (int) (frameSize.height / 2);
        frame.setBounds(x, y, frameSize.width, frameSize.height);

        textArea = new JTextArea();
        textArea.setCaret(new BlockCaret()); //DWM 02-07-2012
        textArea.setBackground(Color.black); //DWM 02-07-2012
        textArea.setForeground(Color.white); //DWM 02-07-2012
        textArea.setCaretColor(textArea.getForeground()); //DWM 02-07-2012
        textArea.setFont(new Font("Lucida Console", Font.PLAIN, 16)); //TPL
        textArea.setLineWrap(true); //DWM 02-07-2012
        textArea.setWrapStyleWord(true); //DWM 02-07-2012
        textArea.setEditable(true); //DWM 02-07-2012
        JButton button = new JButton("clear");

        frame.getContentPane().setLayout(new BorderLayout());
        frame.getContentPane().add(new JScrollPane(textArea), BorderLayout.CENTER);
        frame.getContentPane().add(button, BorderLayout.SOUTH);
        frame.setVisible(true);

        frame.addWindowListener(this);
        button.addActionListener(this);

        try
        {
            PipedOutputStream pout = new PipedOutputStream(this.pin);
            System.setOut(new PrintStream(pout, true));
        }
        catch (java.io.IOException io)
        {
            textArea.append("Couldn't redirect STDOUT to this console\n" + io.getMessage());
            textArea.setCaretPosition(textArea.getDocument().getLength()); //DWM 02-07-2012
        }
        catch (SecurityException se)
        {
            textArea.append("Couldn't redirect STDOUT to this console\n" + se.getMessage());
            textArea.setCaretPosition(textArea.getDocument().getLength()); //DWM 02-07-2012
        }

        try
        {
            PipedOutputStream pout2 = new PipedOutputStream(this.pin2);
            System.setErr(new PrintStream(pout2, true));
        }
        catch (java.io.IOException io)
        {
            textArea.append("Couldn't redirect STDERR to this console\n" + io.getMessage());
            textArea.setCaretPosition(textArea.getDocument().getLength()); //DWM 02-07-2012
        }
        catch (SecurityException se)
        {
            textArea.append("Couldn't redirect STDERR to this console\n" + se.getMessage());
            textArea.setCaretPosition(textArea.getDocument().getLength()); //DWM 02-07-2012
        }

        try
        {
            System.setIn(new PipedInputStream(this.pout3));
        }
        catch (java.io.IOException io)
        {
            textArea.append("Couldn't redirect STDIN to this console\n" + io.getMessage());
            textArea.setCaretPosition(textArea.getDocument().getLength()); //DWM 02-07-2012
        }
        catch (SecurityException se)
        {
            textArea.append("Couldn't redirect STDIN to this console\n" + se.getMessage());
            textArea.setCaretPosition(textArea.getDocument().getLength()); //DWM 02-07-2012
        }

        textArea.addKeyListener(new KeyListener()
        {

            public void keyPressed(KeyEvent e)
            {
            }

            public void keyReleased(KeyEvent e)
            {
            }

            public void keyTyped(KeyEvent e)
            {
                try
                {
                    pout3.write(e.getKeyChar());
                }
                catch (IOException ex)
                {
                }
            }
        }); //DWM 02-07-2012

        quit = false; // signals the Threads that they should exit

        // Starting two seperate threads to read from the PipedInputStreams
        reader = new Thread(this);
        reader.setDaemon(true);
        reader.start();

        reader2 = new Thread(this);
        reader2.setDaemon(true);
        reader2.start();
    }