Question

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 ....

Was it helpful?

Solution

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top