妳可以
TextField txt = new TextField();
txt.setBounds(50,50,120,30);
this.getContentPane()。添加(txt);
while(真)
{
system . out . println(txt . gettext());
}
這些代碼可以無休止地打印語句,所以第壹次得到的值不再是空的。
有實際問題可以貼代碼,幫妳看看。希望能幫到妳。