I have a JTextArea
called taMessage
which displays a message string. This string can be edited by the user at run time.
I have a JLabel lblLength
to show the number of characters. I am using lblLength.setText(taMessage.getText().length()+"/ 160");
to display the character count.
What event listener should I use for taMessage so that as I keep typing text in my text area, lblLength keeps on updating itself?
Something like we see in sites like way2sms or 160by2, where it shows the number of characters left.