0

I am using a JTextArea for a text editor program. Text in the text area is provisionally set in the constructor using:

teaxtArea.setFont("Serif", Font.PLAIN, 14);

I have added event handlers that allow user to select various font styles and sizes. However when the new changes are applied via the setFont method the text already in the text area is changed.

Is it possible to apply the new font to new text only?

Andrew Thompson
  • 168,117
  • 40
  • 217
  • 433
dancingbush
  • 2,131
  • 5
  • 30
  • 66
  • 4
    Please have a look at this [answer](http://stackoverflow.com/a/9651404/1057230) by @mKorbel, I hope it helps :-) Though you need a [JTextPane/JEditorPane](http://docs.oracle.com/javase/tutorial/uiswing/components/editorpane.html) for this sort of thingy to work. – nIcE cOw Aug 14 '13 at 15:10
  • 1
    *"Thanks Ciaran"* Don't include sigs. in questions. They are noise. – Andrew Thompson Aug 14 '13 at 22:28
  • 1
    crossposted on Coderanch – mKorbel Aug 15 '13 at 07:17

0 Answers0