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.
Asked
Active
Viewed 1.5k times
13

mKorbel
- 109,525
- 20
- 134
- 319

Sachin Kumar
- 781
- 1
- 9
- 28
-
4read this: http://docs.oracle.com/javase/tutorial/uiswing/components/editorpane.html , explains well. – pedromss Sep 30 '13 at 12:10
-
4As `JTextPane` is a subclass of `JEditorPane`, the main difference is that `JTextPane` does everything `JEditorPane` does, and then some! – BlackBox Sep 30 '13 at 12:11
-
Which is fast in performance i.e fast while reading contents from file. – Sachin Kumar Sep 30 '13 at 12:15
2 Answers
33
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.

Masudul
- 21,823
- 5
- 43
- 58