I know how to se the font of a regular JTextArea, but how would I get an reference to the selected text and only select that?

Here is what I have so far:

setFont(new Font(font, style = Font.BOLD, size));

this works but changes whole area

textArea2.getSelectedText().setFont(new Font("sansserif",Font.BOLD, 12));

this doesn't work, and this is what I need..

How can i do this/

Re: setting font of selected text 80 80

I just read that you can't do this in a JTextArea. Im gonna have to convert to JTextPane.

Re: setting font of selected text 80 80

it so easy like walking....

commented: Don't post useless drivel in the tech forums. -2
Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.19 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.