JTextPane with XML-code highlight

How can I create new JTextPane or another editor pane with default IDEA's XML code highlight?

0

You can not use JTextPane but you can create a proper editor component instead.


PsiFile file = PsiFileFactory.getInstance(project).createFileFromText(...) - create a file

Document document = PsiDocumentManager.getInstance(project).getDocument(file) - get the document

Editor editor = EditorFactory.getInstance().createEditor(document, project) - create an editor for your document



Use editor.getComponent() to render you text editor (in place of your JTextPane)

0
Avatar
Permanently deleted user

Thanks!

0

请先登录再写评论。