【发布时间】:2010-01-04 14:10:09
【问题描述】:
此方法在我的应用程序中显示一个新窗口:
public void ShowNewCustomerView() {
if (NewCustomer == null) NewCustomer = new NewCustomerView(this);
NewCustomer.setVisible(true);
}
NewCustomerView 类有这个方法:
public void ClearFields() {
txtAddress.setText("");
txtCity.setText("");
txtCompanyName.setText("");
txtCustomerNumber.setText("");
txtOrganisationNumber.setText("");
txtPhoneNumber1.setText("");
txtPhoneNumber2.setText("");
txtPostalCode.setText("");
txtReferenceName.setText("");
}
如何在该行之前运行该方法:
NewCustomer.setVisible(true);
添加这个:
NewCustomer.ClearFields();
...不起作用...这是为什么?
这是我得到的错误: 找不到符号(方法 ClearFields()) 类:javax.Swing.JFrame
但是我创建了一个扩展 JFrame 的 NewCustomerView 的新实例?对吧?
【问题讨论】:
-
怎么不工作了?这些字段中是否有文本内容?
-
更新帖子,看看上面的原因...
-
很抱歉与编辑赛跑,本以为与您同时进行一个小编辑 - 所以显然不检查并发编辑...