Text editor in Java with sample functions for desktop application

2.9k views Asked by At

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.

2

There are 2 answers

0
aioobe On BEST ANSWER

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)

0
dogbane On

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