Hi guys,

I'm writing a Java programme, one with GUI for a project in college.

We separated the work into a few guys doing a few standalone Java classes. These standalone Java classes are run by doing the usual:
java -jar XXX.jar through the console. The functions of the class are issued through by typing commands into the class by way of the console. e.g. /chat mynick message

A few of the other guys designed the GUI.

The question now is.. how do we integrate these two together? I've been googling but I dont know a good sign post.

I'm thinking we need to write an interface between the GUI and the Java classes. Is there a term for this?

We're lost, please advise!

Recommended Answers

All 2 Replies

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() {

And in another class (or in main)

Person pers = new Person();
pers.name = "Name";
pers.age = 10;

Print pr = new Print(pers);

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.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.