Adel Boutros
Adel Boutros

Reputation: 10285

JTextArea with a Title?

Using JTextArea, I would like for the first line to be a simple text (Title of the JTextArea).

Is there a way to make the text center align on the first line?

Upvotes: 1

Views: 3358

Answers (1)

Bill the Lizard
Bill the Lizard

Reputation: 405925

I don't think you can do this with a simple JTextArea. You might consider switching to a JTextPane, which supports HTML markup. The Java Tutorial How to Use Editor Panes and Text Panes shows an example.

Alternatively, you can just add a JLabel above your JTextArea where you display the title text.

Upvotes: 2

Related Questions