doc = (StyledDocument) textPane.getDocument();
err = textPaneError.getStyledDocument();
try {
textPane.setText("\b");
doc.insertString(textPane.getCaretPosition(), (String) stack.pop(), styleT);
doc.insertString(textPane.getCaretPosition()-1, "\n", styleB);
} catch (BadLocationException e1) {
try {
err.insertString(0, "There is no opened tag", styleR);
} catch (BadLocationException e) {
e.printStackTrace();
}
}
我正在尝试在 JTextPane 中打印所有异常。这是我的代码,它不起作用。有人可以告诉我问题出在哪里吗?谢谢