Posted By:
Anonymous
Posted On:
Monday, March 25, 2002 02:35 PM
Use callback method parameters, something like
class Main {
private GUIClass gc1;
public void receive(Object data) {
database.setName(data.name);
database.setAddress(data.address);
}//receive
//constructor for Main class
Main() {
//passing this instance as reference to gui class
GUIClass gc1 = new GUIClass(this);
}
public static void main(String args[]) {
Main m = new Main();
}//main
}//Main
class GUIClass {
private Main m;
private MyDataObject data = new MyDataObject;
//Constructor with reference to main class
GUIClass(Main m) {
this.m = m;
}//constructor
private void handleInputData() {
data.name = "John";
data.address = "Swing Road 1"
m.receive(data);
}//handleInputData
}//GUIClass
This is the most simple way to do it, I think. Maybe too simple for a real-world-app, but it's a start ...
(eh, and don't expect this to compile without some cleanup :-)
--
jonmartin.solaas@mail.link.no