问题
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