How do I make a label to show the charcount of a TextArea? I have the following code:
public void onChange(Field field, Object newVal, Object oldVal){
counterLabel.setText(textArea.getValueAsString().length() + "/160");
}
problem is I have to click the label for i to change the charcount.
help please
textArea.addKeyPressListener(new EventCallback(){
@Override
public void execute(EventObject e) {
// TODO Auto-generated method stub
}
});
Use this EventCallback and in the execute method just use your method counterLabel.setText(textArea.getValueAsString().length() + "/160");