public Console()
        {
                // 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.setEditable(false);
                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.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());
                }
                catch (SecurityException se)
                {
                        textArea.append("Couldn't redirect STDOUT to this console\n"+se.getMessage());
            }
               
                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());
                }
                catch (SecurityException se)
                {
                        textArea.append("Couldn't redirect STDERR to this console\n"+se.getMessage());
            }          
                       
                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();
                               
                       
        }