我有一个超类Car和两个扩展的类Car(CarToRent和CarToSell) 在类CarCompany中,我在构造函数中实现了一个 GUI。
我有一个按钮:
addCarToRentButton = new JButton("Add Car To Rent");
contentPane.add(addCarToRentButton);
addCarToRentButton.addActionListener(this);
如何添加一个动作来监听这个,以便在单击按钮时,它将来自 3 个文本字段的数据输入到Car类数组中?(文本字段是dailyRateTextField,descriptionTextField和downPaymentTextField)。