public ConsoleTextArea(String[] argv) { super(); history = new java.util.ArrayList<String>(); console1 = new ConsoleWriter(this); console2 = new ConsoleWriter(this); out = new PrintStream(console1, true); err = new PrintStream(console2, true); PipedOutputStream outPipe = new PipedOutputStream(); inPipe = new PrintWriter(outPipe); in = new PipedInputStream(); try { outPipe.connect(in); } catch(IOException exc) { exc.printStackTrace(); } getDocument().addDocumentListener(this); addKeyListener(this); setLineWrap(true); setFont(new Font("Monospaced", 0, 12)); }
synchronized void returnPressed() { Document doc = getDocument(); int len = doc.getLength(); Segment segment = new Segment(); try { doc.getText(outputMark, len - outputMark, segment); } catch(javax.swing.text.BadLocationException ignored) { ignored.printStackTrace(); } if(segment.count > 0) { history.add(segment.toString()); } historyIndex = history.size(); inPipe.write(segment.array, segment.offset, segment.count); append("\n"); outputMark = doc.getLength(); inPipe.write("\n"); inPipe.flush(); console1.flush(); }
public ConsoleTextArea(String[] argv) { super(); history = new java.util.ArrayList<String>(); console1 = new ConsoleWriter(this); console2 = new ConsoleWriter(this); out = new PrintStream(console1, true); err = new PrintStream(console2, true); PipedOutputStream outPipe = new PipedOutputStream(); inPipe = new PrintWriter(outPipe); in = new PipedInputStream(); try { outPipe.connect(in); } catch(IOException exc) { exc.printStackTrace(); } getDocument().addDocumentListener(this); addKeyListener(this); setLineWrap(true); setFont(new Font("Monospaced", 0, 12)); }
synchronized void returnPressed() { Document doc = getDocument(); int len = doc.getLength(); Segment segment = new Segment(); try { doc.getText(outputMark, len - outputMark, segment); } catch(javax.swing.text.BadLocationException ignored) { ignored.printStackTrace(); } if(segment.count > 0) { history.add(segment.toString()); } historyIndex = history.size(); inPipe.write(segment.array, segment.offset, segment.count); append("\n"); outputMark = doc.getLength(); inPipe.write("\n"); inPipe.flush(); console1.flush(); }
synchronized void returnPressed() { Document doc = getDocument(); int len = doc.getLength(); Segment segment = new Segment(); try { doc.getText(outputMark, len - outputMark, segment); } catch(javax.swing.text.BadLocationException ignored) { ignored.printStackTrace(); } if(segment.count > 0) { history.add(segment.toString()); } historyIndex = history.size(); inPipe.write(segment.array, segment.offset, segment.count); append("\n"); outputMark = doc.getLength(); inPipe.write("\n"); inPipe.flush(); console1.flush(); }
public ConsoleTextArea(String[] argv) { super(); history = new java.util.ArrayList<String>(); console1 = new ConsoleWriter(this); console2 = new ConsoleWriter(this); out = new PrintStream(console1, true); err = new PrintStream(console2, true); PipedOutputStream outPipe = new PipedOutputStream(); inPipe = new PrintWriter(outPipe); in = new PipedInputStream(); try { outPipe.connect(in); } catch(IOException exc) { exc.printStackTrace(); } getDocument().addDocumentListener(this); addKeyListener(this); setLineWrap(true); setFont(new Font("Monospaced", 0, 12)); }
int len = getDocument().getLength(); replaceRange(str, outputMark, len); int caretPos = outputMark + str.length(); historyIndex++; if(historyIndex < 0) {historyIndex = 0;} int len = getDocument().getLength(); if (historyIndex < history.size()) { String str = history.get(historyIndex);
int len = getDocument().getLength(); replaceRange(str, outputMark, len); int caretPos = outputMark + str.length(); historyIndex++; if(historyIndex < 0) {historyIndex = 0;} int len = getDocument().getLength(); if (historyIndex < history.size()) { String str = history.get(historyIndex);
int len = getDocument().getLength(); replaceRange(str, outputMark, len); int caretPos = outputMark + str.length(); historyIndex++; if(historyIndex < 0) {historyIndex = 0;} int len = getDocument().getLength(); if (historyIndex < history.size()) { String str = history.get(historyIndex);