Como por uma palavra em negrito no JTextArea?

Pessoal, boa tarde.

Em um JTextArea eu seleciono um intervalo de texto e gostaria que ele ficasse em negrito.

Alguém saberia como fazer?

Se não em engano voce consegue colocar texto com html no JTextArea.

Tente colcoar essa parte entre e

No JTextArea não tem como fazer. Para isso, você precisa usar um JTextPane ou um JEditorPane, se o texto for editável:
http://java.sun.com/docs/books/tutorial/uiswing/components/editorpane.html
http://java.sun.com/docs/books/tutorial/uiswing/components/generaltext.html

[quote=ViniGodoy]No JTextArea não tem como fazer. Para isso, você precisa usar um JTextPane ou um JEditorPane, se o texto for editável:
http://java.sun.com/docs/books/tutorial/uiswing/components/editorpane.html
http://java.sun.com/docs/books/tutorial/uiswing/components/generaltext.html[/quote]

So completando o que o Vini falou, dentro de um JTextPane faca o seguinte:

O bom de fazer da forma abaixo é que não importa se o conteúdo é html, rtf, etc. Vai funcionar sempre.

Pra isso funcionar, na criacão to textPane voce tem que setar o documento sendo do tipo StyledDocument, além do Content-Type, por exemplo text/html

[]s

Kemper

           StyledDocument documento = (StyledDocument) textPane.getDocument();
            MutableAttributeSet bold = new SimpleAttributeSet();
            StyleConstants.setBold(bold, true);

            int start = this.textPane.getSelectionStart();
            int len = this.textPane.getSelectionEnd() - this.textPane.getSelectionStart();

            documento.setCharacterAttributes(start, len, bold, false);