I have made a Container
compound by a TextArea
and a CheckBox
. In my app, I create so many of this "Containers
" and add to each TextArea
inside of them an ActionListener
(implemented by the class). Something like this:
for(int i = 0 ; i<20;i++){
MyContainer c = new MyContainer();
TextArea t = c.getTextArea();
t.addActionListener(this);
}
I want the TextArea
to catch the event and if it is pressed put the CheckBox
checked or unchecked. It works fine in non-touch devices and simulators but in the touch devices or emulators, the TextArea
doesn't catch the event. I tried to put the TextArea
as the lead component of the Container
but it doesn't works because Container
doesn't have an addActionListener
method.
It is better that you
derive
theTextArea
class for thegetTextArea()
method. Then in this class implement thepointerReleased
method : code the action performed in the normal way in it.