开发者

Setting fonts in a JTextArea

开发者 https://www.devze.com 2022-12-23 12:03 出处:网络
I\'ve got a JTextArea which has the following text \"Text1 Text2 Text3\". Is there a way I can makeall of them different fonts? E.g. \"Text1\" is bold, \"Text2\" is italic and \"Text3\" is normal?

I've got a JTextArea which has the following text "Text1 Text2 Text3". Is there a way I can make all of them different fonts? E.g. "Text1" is bold, "Text2" is italic and "Text3" is normal?

I know I can create a Font object, however I can only apply it the JText开发者_StackOverflowArea object.

Thanks.


This is not possible in JTextArea. But you can use JTextPane or JEditorPane.

0

精彩评论

暂无评论...
验证码 换一张
取 消