redirect inputStream to JTextField
        Posted  
        
            by 
                gt_ebuddy
            
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by gt_ebuddy
        
        
        
        Published on 2011-07-12T11:48:45Z
        Indexed on 
            2012/07/11
            9:15 UTC
        
        
        Read the original article
        Hit count: 284
        
I want to redirect the Standard System input to JTextField, So that a user must type his/her input in JTextField (instead of console.)
I found System.setIn(InputStream istream) for redirecting System.in. 
Here is my scratch code where i confused on reading from JTextField - inputJTextField.
 System.setIn(new InputStream() {
     @Override
         public int read() throws IOException {
         //how to read content?
         return Integer.parseInt(inputJTextField.getText());
      }
  });
My Question is how to read content from GUI Component ( like JTextField and Cast it to String and other types after redirecting the input stream?
© Stack Overflow or respective owner