Multiple fonts and styles in JTextComponent

87 views Asked by At

I am looking for a way to print content in JTextComponent's text with multiple fonts and styles. For example: first Title with bigger font and then some custom text in different style in one component

1

There are 1 answers

0
camickr On BEST ANSWER

You can use a JTextPane for this. You can control font, color, bold, size etc.

Read the section from the Swing tutorial on Text Component Features for more information and working examples.

For a another simple example to get you started check out: Is there a way to filter / search for content in a HTMLEditorKit?