2009-11-25 44 views
0

我有一个Main Frame和一个JDialog,我在主框架中创建一个对象,然后用它的构造函数将它发送给JDialog,然后将它分配给具有类型的新对象,然后向它添加一些信息JDialog中的新对象,但在此之后,我需要Main Frame中的新对象信息,我该怎么办?我应该如何获取新对象的信息?

我应该从JDialog发送新的对象到主框架吗?如果是,如何?

回答

0

不,你不必发回东西(在你的情况)。这真的是这样的:

public void addStudentAction() { 
    AddStudent myAddStudentDialog = new AddStudent(this, true, this.management); 
    myAddStudentDialog.setVisible(true); 
    // now you enter a password on the dialog 
    if (this.management.getStudentsPasswort() == null) { 
    // There's a bug in AddStudent class 
    } else { 
    System.out.println("HipHipHooray"); 
    } 
} 

(我想这个问题是关系到你前面的问题,这就是为什么我选择了这个 - 另有蹊跷 - 例如)

希望它能帮助!

相关问题