In this image the text is not centered, it is much higher than JTextArea
:
And I would also like the text to start in the middle of JTextArea
and adjust as I write.
What method can I use to fix this?
Using Jpanel you could do this:
StyledDocument doc = textPane.getStyledDocument();
SimpleAttributeSet center = new SimpleAttributeSet();
StyleConstants.setAlignment(center, StyleConstants.ALIGN_CENTER);
doc.setParagraphAttributes(0, doc.getLength(), center, false);