Setting fonts in a JTextArea

﹥>﹥吖頭↗ 提交于 2020-01-05 08:02:01

问题


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 JTextArea object.

Thanks.


回答1:


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



来源:https://stackoverflow.com/questions/2488384/setting-fonts-in-a-jtextarea

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!