错误行在下面的代码中指出。我注意到的是,如果我突出显示“客户”一词并按住ctrl-T,则会弹出显示“客户-SwimCalc”正确的层次结构。但是如果我对Contractor做同样的事情,它会说Contractor-SwimCalc.Customer
public class SwimCalc extends JFrame implements ActionListener {
private JTabbedPane jtabbedPane;
private JPanel Customers;
private JPanel Contractors;
private List<Customer> customers = new ArrayList<Customer>();
// this fails
private List<Contractor> contractors = new ArrayList<Contractor>();
JTextArea NameTextCustomers, ExistTextCustomers, MessageTextCustomers,
NameTextContractors, ExistTextContractors, MessageTextContractors;
JTextField lengthTextPool, widthTextPool, depthTextPool, volumeTextPool;
public SwimCalc() {
setTitle("Volume Calculator");
setSize (300, 200);
JPanel topPanel = new JPanel();
topPanel.setLayout( new BorderLayout() );
getContentPane().add( topPanel );
createCustomers();
createContractors();
jtabbedPane = new JTabbedPane();
jtabbedPane.addTab("Customer", Customers);
topPanel.add(jtabbedPane, BorderLayout.CENTER);
}
}
最佳答案
错误“承包商无法解析为类型”可能意味着
您从未在代码中的任何地方编写class Contractor {...}
由于某些构建路径问题,Eclipse无法编译整个项目(请查看“问题”视图以查看构建路径错误)
您忘记导入类型Contractor
关于java - 不同的等级,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/5474859/