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?
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.