Indigo_heart
Indigo_heart

Reputation: 139

Multiple fonts and styles in JTextComponent

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

Upvotes: 1

Views: 103

Answers (1)

camickr
camickr

Reputation: 324207

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?

Upvotes: 1

Related Questions