Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个 JTextArea,其中包含以下文本“Text1 Text2 Text3”。有没有办法让它们都变成不同的字体?例如“Text1”是粗体,“Text2”是斜体,“Text3”是正常的?
我知道我可以创建一个 Font 对象,但是我只能将它应用于 JTextArea 对象。
谢谢。
这在 JTextArea 中是不可能的。但是您可以使用 JTextPane 或 JEditorPane。