JEditorpane vs. JTextPane
Asked Answered
S

2

13

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.

Sandrasandro answered 30/9, 2013 at 12:7 Comment(3)
read this: docs.oracle.com/javase/tutorial/uiswing/components/… , explains well.Haematoid
As JTextPane is a subclass of JEditorPane, the main difference is that JTextPane does everything JEditorPane does, and then some!Octagonal
Which is fast in performance i.e fast while reading contents from file.Sandrasandro
Z
11

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.

Zigrang answered 30/9, 2013 at 12:12 Comment(0)
G
32

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.

Gussy answered 30/9, 2013 at 12:15 Comment(0)
Z
11

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.

Zigrang answered 30/9, 2013 at 12:12 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.