jf.add(textField);
textField.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
//因为e.getSource返回值类型是Object,所以强转为TextField,使用里面的方法获取吸text
TextField source = (TextField)e.getSource();
System.out.println(source.getText());
}
});
标签:getSource,source,监听,输入框,TextField,textField
From: https://www.cnblogs.com/geeklee/p/17285827.html