listeners between classes

i have a class that implements actionlistener and another that doesnt

is there a way to make the static non-listener class run the listener on the non-static listener class

objChannelGUIs[0].objSendTextBox.addKeyListener(this);

i was wondering if "this" could be replacesd with something, the classes are as follows

publicclass cClientextends JAppletimplements ActionListener, KeyListener

{

...

}

class ReceiverThreadextends Thread

{

...

}

[818 byte] By [Ghelyara] at [2007-10-1 6:33:24]
# 1

Replace "this" with an instance of the class with the listener. In your example I assume that ReceiverThread is the "static non-listener class".

So...

Either create a new instance of Client or get it from somewhere else (Pass an instance in a constructor of RecieverThread or have a public setter for the instance)

So, say the reference to the instance goes in a variable called clientInstance that is passed in a constructor ReeiverThread(Client clientInstance)

objChannelGUIs[0].objSendTextBox.addKeyListener(clientInstance);

amylsmitha at 2007-7-9 15:50:23 > top of Java-index,Archived Forums,Java 2 Software Development Kit (J2SE SDK)...