我的程序有问题:
有几节课
class Info{
private String number;
private Date date;
private String user;
private double sum;
private String nameCurrency;
private double courceOfCurrency;
public void setNumber(String s){
this.number = s;
}
public void setDate(Date d){
this.date = d;
}
public void setUser(String user){
this.user = user;
}
public void setSum(double sum){
this.sum = sum;
}
public void setNameCurrency(String nameCurrency){
this.nameCurrency = nameCurrency;
}
public void setCourceOfCurrency(double courceOfCurrency){
this.courceOfCurrency = courceOfCurrency;
}
public String getNumber(){
return number;
}
public Date getDate(){
return date;
}
public String getUser(){
return user;
}
public double getSum(){
return sum;
}
public String getNameCurrency(){
return nameCurrency;
}
public double getCourceOfCurrency(){
return courceOfCurrency;
}
}
class Bill extends Info{
private String product;
private double qty;
public void setProduct(String s){
this.product = s;
}
private void setQty(double qty){
this.qty = qty;
}
public String getProduct(){
return product;
}
public double getQty(){
return qty;
}
}
主要的
public class Main {
public static void main(String[] args) {
JFrame frame = new MainFrame("TestWork");
frame.setVisible(true);
}
}
在 MainFrame 类:
//something
DefaultListModel listModel = new DefaultListModel();
JList list = new JList(listModel);
//sometheing
和类SecondFrame
。有几个JLabel
和JTextfield
。问题:如何从中获取价值JTextField(SecondFrame)
并投入其中JList(MainFrame class)
?