3

I have a project, I'm creating an application in Java and I need text editor with sample functions (Bold, Italic, Size, Align, Undo, Redo).

So is there a class in Java for this purpose or a tutorial to show how to develop it?

I tried to style text in a jTextPane but when I change a word in bold, the whole text become in bold.

I want just to stylize the selected text only.

Ali Ben Messaoud
  • 11,690
  • 8
  • 54
  • 87

2 Answers2

3

This should get you started: Editor based on JTextPane

enter image description here


Or this tutorial: How to Use Editor Panes and Text Panes


(source: oracle.com)

Glorfindel
  • 21,988
  • 13
  • 81
  • 109
aioobe
  • 413,195
  • 112
  • 811
  • 826
1

The Java Tutorial's TextComponentDemo illustrates many features such as undo/redo, styling selected text and binding key strokes to editing actions.

Community
  • 1
  • 1
dogbane
  • 266,786
  • 75
  • 396
  • 414