Java GUI is just another class. You can create instances of other classes inside and call their methods.
Small, silly example:
class Person {
public String name;
public int age;
public Person() {
}
}
class Print {
private Person person;
public Print(Person p) {
person = p;
}
public void print() {
System.out.println(person.name+";"+person.age);
}
}
And in another class (or in main)
Person pers = new Person();
pers.name = "Name";
pers.age = 10;
Print pr = new Print(pers);
pr.print();
javaAddict
Nearly a Senior Poster
3,329 posts since Dec 2007
Reputation Points: 1,014
Solved Threads: 448
Add methods to the stand-alone classes so their functionality can be called from Java, eg public sendChat(String nick, String message).
Then, in the GUI have entry fields for the required data, when the user clicks OK, get the data from the fields and use it to call the functionality via these new methods.
ps It's called MVC. Model (ie the functionality) View (ie the user interface) and Controller (the logic that links the two). In this case, like many others, the controller logic is trivial so it gets combined with the view code.
JamesCherrill
Posting Genius
6,371 posts since Apr 2008
Reputation Points: 2,130
Solved Threads: 1,073