/** * Creates a new EvalTextArea. */ public EvalTextArea(SwingGui debugGui) { this.debugGui = debugGui; history = Collections.synchronizedList(new ArrayList<String>()); Document doc = getDocument(); doc.addDocumentListener(this); addKeyListener(this); setLineWrap(true); setFont(new Font("Monospaced", 0, 12)); append("% "); outputMark = doc.getLength(); }
/** * Creates a new EvalTextArea. */ public EvalTextArea(SwingGui debugGui) { this.debugGui = debugGui; history = Collections.synchronizedList(new ArrayList<String>()); Document doc = getDocument(); doc.addDocumentListener(this); addKeyListener(this); setLineWrap(true); setFont(new Font("Monospaced", 0, 12)); append("% "); outputMark = doc.getLength(); }
/** * Creates a new EvalTextArea. */ public EvalTextArea(SwingGui debugGui) { this.debugGui = debugGui; history = Collections.synchronizedList(new ArrayList<String>()); Document doc = getDocument(); doc.addDocumentListener(this); addKeyListener(this); setLineWrap(true); setFont(new Font("Monospaced", 0, 12)); append("% "); outputMark = doc.getLength(); }
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);
/** * Called when Enter is pressed. */ private 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(); } String text = segment.toString(); if (debugGui.dim.stringIsCompilableUnit(text)) { if (text.trim().length() > 0) { history.add(text); historyIndex = history.size(); } append("\n"); String result = debugGui.dim.eval(text); if (result.length() > 0) { append(result); append("\n"); } append("% "); outputMark = doc.getLength(); } else { append("\n"); } }
/** * Called when Enter is pressed. */ private 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(); } String text = segment.toString(); if (debugGui.dim.stringIsCompilableUnit(text)) { if (text.trim().length() > 0) { history.add(text); historyIndex = history.size(); } append("\n"); String result = debugGui.dim.eval(text); if (result.length() > 0) { append(result); append("\n"); } append("% "); outputMark = doc.getLength(); } else { append("\n"); } }
/** * Called when Enter is pressed. */ private 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(); } String text = segment.toString(); if (debugGui.dim.stringIsCompilableUnit(text)) { if (text.trim().length() > 0) { history.add(text); historyIndex = history.size(); } append("\n"); String result = debugGui.dim.eval(text); if (result.length() > 0) { append(result); append("\n"); } append("% "); outputMark = doc.getLength(); } else { append("\n"); } }