Advertisement
Guest User

Untitled

a guest
Jan 18th, 2018
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.48 KB | None | 0 0
  1. package hr.fer.oop.lab5.Zad1;
  2.  
  3. import java.io.IOException;
  4. import java.io.OutputStream;
  5. import javax.swing.*;
  6.  
  7. public class StreamOutput extends OutputStream {
  8.     private JTextArea textArea;
  9.  
  10.     public StreamOutput(JTextArea textArea){
  11.         this.textArea=textArea;
  12.     }
  13.     @Override
  14.     public void write(int b) throws IOException {
  15.         textArea.append(String.valueOf((char) b));
  16.         textArea.setCaretPosition(textArea.getDocument().getLength());
  17.     }
  18. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement