How to know programmatically the actual modified component?

105 Views Asked by At

In J2ME there is the interface ItemStateListener which can detect exactly the item which is being changed. Is there a similar way in LWUIT ? I tried using the DataChangedListener interface but it gives the character position within the TextField , or -1 , for the index argument ! So ....

1

There are 1 best solutions below

0
On BEST ANSWER

Initially set the boolean value to false and add the listener for the components then if any event occurs on that components, set the boolean value to true. Use the addDataChangeListener(It only for TextField) or addActionListener for the components. On addDataChangeListener returns two index values. Initially returns -1 and then returns current text position of the TextField. AFAIK On TextField, they set the default index value is -1 for fireDataChanged on setText method. That is why it will returns -1 initially.