日期:2014-05-20 浏览次数:20696 次
public class MainPanel1 implements ActionListener,FocusListener{
//定义成员变量
private JTextField f_filename = new JTextField(10);
private JTextField f_rootpath = new JTextField(5);
@Override
public void focusLost(FocusEvent e) {
JTextField source = (JTextField) e.getSource();
//比较对象,只能通过这种方式吗?
if(source==f_filename){
//相关操作...
}else if(source==f_rootpath){
//相关操作...
}
}
//...此处省略10000字
}