Categories: MSDN / DotNet / Java / Scripts / Linux / PHP Ask - La ask - La Answer

Communication between classes

Goodday all.

For school, I am asked to write a program in Java. The program should arrange for a barrier (up and down moving thingy at the beginning of i.e. a parking lot) to open or close.

The opening and closing, I can manage. It's just writing bits to a paralel port, using a library I already have.

The program also has to have a GUI. No probs, also that was easy. Now for the problem: the program should start with a class named Manager. This should initiate the GUI.

The barrier and the GUI should run in two different threads (problem number one, but I think I can figure that out).

The biggest problem is: How do I get the manager to see input (i.e. a clicked button) on the GUI and how do I let the manager call the appropriate function on to class ParaController (the controller of the barrier, which has the functions barrierOpen() and barrierClose().

Could someone show me (pseudo code should do). I've tried making the manager class a parent and the GUI a child, but I still don't get it.

Regards,

Frits.
[1106 byte] By [frits.theunis] at [2007-11-11 8:36:26]