如何定位JTextArea? [英] How to position JTextArea?

查看:106
本文介绍了如何定位JTextArea?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,



每当我尝试使用setPosition时,我的JTextArea似乎无法正常工作,有人可以告诉我原因吗?



这是我的代码:



Hi everyone,

It seems like my JTextArea is not working whenever I try to setPosition, can anyone tell me why?

here is my code:

super("paySlipCalculator MOFO!");
setLayout(new FlowLayout());


calculate = new JTextArea(5,5);
calculate.setVisible(true);
calculate.setLineWrap (true);
add(calculate);



基于我所知道的setLayout将关注may对象的所有定位,默认情况下它是从左到右,直到它到达结束时在窗口的右侧,我如何排除这个我的计算JTextArea所以我可以随意移动它?



谢谢,


based on what I know the setLayout will takecare of all the positioning of may objects and by default it's in left to right until it hit the end of the right side of the window, How can I exclude this my calculate JTextArea so I can freely move it around?

Thanks,

推荐答案

calculate = new JTextArea(5,5);
//calculate.setBounds(x,y,width,height); /*x,y,width,height are integer Values*/
calculate.setBounds(10,10,200,60);
calculate.setVisible(true);
calculate.setLineWrap (true);
add(calculate);


嘿伙计们谢谢,



我发现它,我将setLayout设置为null并手动指示所有对象的大小和位置(我不确定这是否是java中的正确术语,请纠正我,如果我'我错了)。谢谢大家。
Hey guys thanks,

I found it, I set the setLayout to null and manually direct the size and position of all the objects(im not sure if this is the right term in java please correct me if i'm wrong). Thanks everyone.


这篇关于如何定位JTextArea?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆