我有一个 JTextArea,其中包含以下文本“Text1 Text2 Text3”。 有没有办法让它们都变成不同的字体?例如。 “Text1”是粗体,“Text2”是斜体,“Text3”是正常的?
我知道我可以创建一个 Font 对象,但是我只能将它应用到 JTextArea 对象。
谢谢。
最佳答案
这is not possible在 JTextArea 中。但您可以使用 JTextPane 或 JEditorPane。
关于java - 在 JTextArea 中设置字体,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2488384/