JTextfield getText问题~
public void actionPerformed(ActionEvent e)
{
String str1 , str2 , str3;
//这行textfield_1出错了 str1 = (String)(textfield_1.getText()) ;
toTable(); //把Title,Password,Name输出到table
toDataBase(); //吧Title,Password,Name保存到数据库
}
报错是:Cannot refer to a non-final variable textfield_1 inside an inner class defined in a different method
为什么啊 ??
[解决办法]
textfield_1 前加上final关键字就行了