Is there a way to horizontally align a text in a textarea from awt? There is a getAlignment method but not a setAlignment. And I just want to use awt, not swing
Asked
Active
Viewed 5,169 times
0
-
1You have to upload some code. We can't help you like that. – Branislav Lazic Mar 06 '14 at 15:18
-
http://stackoverflow.com/questions/3213045/centering-text-in-a-jtextarea-or-jtextpane-horizontal-text-alignment – Hugo Sousa Mar 06 '14 at 15:22
-
1*"And I just want to use awt, not swing"* ..Why? – Andrew Thompson Mar 07 '14 at 06:57
2 Answers
2
There is no alignment property for a TextArea. The alignment is determined by which LayoutManager you are using.

Arjit
- 3,290
- 1
- 17
- 18
0
You should try putting your components(eg TextArea) into containers it makes laying them out a much less stressfull task.
Take a look here: http://docs.oracle.com/javase/tutorial/uiswing/layout/visual.html
GridLayout or BorderLayout may be ones you should take a look at in particular. Best of luck!

javawocky
- 899
- 2
- 9
- 31