1

我想将可投掷的堆栈跟踪打印到 Textarea

像这样的东西:

textArea.setText(throwableElement.toString() + "\n" + throwableElement.printStackTrace());

那可能吗?

我希望你能帮帮我

谢谢

4

1 回答 1

4

你可以做

StringWriter stackTraceWriter = new StringWriter();
throwableElement.printStackTrace(new PrintWriter(stackTraceWriter));
textArea.setText(throwableElement.toString() + "\n" + stackTraceWriter.toString());
于 2015-10-29T10:39:25.493 回答