yongyih
asked on
I want to know how to pass data between JFrame
I want to know how to pass data between 2 JFrame.
For example,
main menu (Jframe) load another JFrame called loadFiles.
I want the loadFiles to return 3 String. How to do this?
I try to put that three String in a class and pass to the loadFiles constructor. The problem is i cannot access in button's ActionListener. The error message is cannot access in inner class.
public class Test{
private MyData myData;
public Test(MyData myData){ // pass from main menu
this.myData=myData;
// other coding here..
}
}
cmdOk.addActionListener(ne w ActionListener(){
public void actionPerformed(ActionEven t e){
// here
myData.setName(txtName.get Text());
}
});
Any idea how to solve this problem??
Hopefully you guys can understand my question ^^
For example,
main menu (Jframe) load another JFrame called loadFiles.
I want the loadFiles to return 3 String. How to do this?
I try to put that three String in a class and pass to the loadFiles constructor. The problem is i cannot access in button's ActionListener. The error message is cannot access in inner class.
public class Test{
private MyData myData;
public Test(MyData myData){ // pass from main menu
this.myData=myData;
// other coding here..
}
}
cmdOk.addActionListener(ne
public void actionPerformed(ActionEven
// here
myData.setName(txtName.get
}
});
Any idea how to solve this problem??
Hopefully you guys can understand my question ^^
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER