tags:

views:

47

answers:

1

I have a Main Frame and a JDialog ,I make an object in the Main Frame and I sent it to the JDialog with its constructor ,and I assign it to the new object which has type like that.and I add some information to the new object in the JDialog but after that I need the new object's information in the Main Frame what should I do?

Should I send the new object from JDialog to the Main Frame ? If yes, how?

A: 

No, you don't have to send something back (in your case). It really works like this:

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");
  }
}

(I guess the problem is related to your previous question, that's why I chose this - otherwise strange - example)

Hope it helps!

Andreas_D