[英]Center text in TextArea
Is there a way to horizontally align a text in a textarea from awt? 有没有办法从文本区域中水平对齐textarea中的文本? There is a getAlignment method but not a setAlignment.
有一个getAlignment方法但不是setAlignment。 And I just want to use awt, not swing
而我只想使用awt,而不是挥杆
There is no alignment property for a TextArea. TextArea没有对齐属性。 The alignment is determined by which LayoutManager you are using.
对齐方式取决于您使用的LayoutManager。
You should try putting your components(eg TextArea) into containers it makes laying them out a much less stressfull task. 你应该尝试将你的组件(例如TextArea)放入容器中,这使得它们能够完成一项压力较小的任务。
Take a look here: http://docs.oracle.com/javase/tutorial/uiswing/layout/visual.html 看看这里: http : //docs.oracle.com/javase/tutorial/uiswing/layout/visual.html
GridLayout or BorderLayout may be ones you should take a look at in particular. GridLayout或BorderLayout可能是您应该特别关注的。 Best of luck!
祝你好运!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.