Have you got a frame class with a main method and nothing else in?
If you are creating a Controller, put the main method in a ControllerDemo class (and think of a better name for it). Let your application create the Controller object, and the frame object, and then you can pass the objects references to each other.
Joined: Aug 02, 2012
Thanks, ah, I think in the same way, I can pass an JFrame object reference such as "new CController(this);" to the controller.
Your hint was great.
Joined: Oct 13, 2005
Well done It is always good when you can see poeple learning.
Just beware of letting a this reference escape. Letting other classes get hold of a this reference is all right, provided the this is in a consistent state. The one place a this can legitimately be inconsistent is inside the constructor. There is an example here, which is similar to something I remember having seen somewhere on the Ranch earlier.
Have a look at that example, and make sure not to fall into the error shown there.