JEditorpane vs. JTextPane

倖福魔咒の 提交于 2019-12-10 12:38:43

问题


i have to create a project in java swing for my college. An editor of java files with proper text highlighting i.e different colors and fonts for java keywords, java comments and for normal text.
Help me to select one of two styled text component JEditorpane and JTextPane provided by java so that i can full-fill the requirements.
Please tell me suitable difference between these two that in which kind of situation i have to use one of these.


回答1:


You can use either of them, but if it is a rich text editor then I would suggest using the JTextPane.

You may also find this topic useful.




回答2:


Although both support rich text. But there is difference.

JEditorPane supports display/editing of HTML.

JTextPane is an extension of JEditorPane which provides word processing features like fonts, text styles, colors, etc.



来源:https://stackoverflow.com/questions/19093851/jeditorpane-vs-jtextpane

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!