System.setOut(out);
System.setOut(outstream);
   public static void main(String[] args) {      // Example of use      Display display;      try {         // Execution         System.out.println("# B # Display Executing ");         // Display Streams         OutputStream dout = System.out;         InputStream din = System.in;         PrintStream out = System.out;         if (org.smartfrog.services.display.WindowUtilities.             areGraphicsAvailable()) {            display = new Display(" Output display ...", null);            display.setVisible(false);            org.smartfrog.services.display.WindowUtilities.            setPositionWindow(null,display, 0, 1);            //panel Tree Class. Example to extend Display ;-)            JPanel panelTree = new JPanel();            BorderLayout borderLayout1 = new BorderLayout();            JTree jTree1 = new JTree();            jTree1.setAutoscrolls(true);            panelTree.setLayout(borderLayout1);            panelTree.add(jTree1, BorderLayout.CENTER);            display.tabPane.add(panelTree, "Test new panel");            //end panelTree example            display.setSize(750, 400);            display.setVisible(true);            dout = display.getOutputStream();            din = display.getInputStream();            out = display.getPrintStream();            // Redirecting standard output:            System.setOut(out);            // System standard OUT -> screen PrintStream            System.setErr(out);            // System standard ERR -> screen PrintStream            System.setIn(din);            // Screen ImputStreamSystem readed -> standard IN readed         }         //Testing output         System.out.println(               "Testing Redirection to Display: using System.out");         out.println("Printing directly using PrintStream");         System.err.println("Printing directly using System.err");         // Testing standard imput from user:         BufferedReader br = new BufferedReader(new InputStreamReader(               System.in));         String line = "";         System.out.println("Reading (type 'end' to finish)...");         while (!line.equals("end")) {            try {               System.out.println("Enter something ;-) <ENTER>: ");               line = br.readLine();               System.out.println("Typed: " + line);            } catch (Exception e) {               e.printStackTrace();            }            //end catch         }         //         //end while         // Timer to test autoScroll:         Timer t = new Timer(1 * 1000,            new ActionListener() {               SimpleDateFormat fmt = new SimpleDateFormat("HH:mm:ss");               public void actionPerformed(ActionEvent evt) {                  String message = "timer..." +                        fmt.format(new Date());                  System.out.println("Stdout:" + message);               }            });         t.start();      } catch (Exception e) {         System.err.println("Error in 'full' execution code:\n" + e);         e.printStackTrace();      }   }