I suspect this line FileGUI fGUI = new FileGUI();
in your MouseControl class.
I suspect in your FileGUI
class's constructor you are trying to create new instance of MouseControl
and attach as listener, again while creating new instance of MouseControl
, MouseControl
again tries to create instance of FileGUI
and goes recursively until JVM throws a StackOverflowException
If this is the case I suggest you to modify constructor of MouseControl to receive an instance of FileGUI class and use that in MouseControl.