By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
454,655 Members | 1,541 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 454,655 IT Pros & Developers. It's quick & easy.

How to count key stroke if anyone paste something without typing then keystrokes coun

P: 1
How to count key stroke: if on client side anyone type anything then how to count keystroke and if anyone paste something without typing then keystrokes counts or not?
Oct 8 '13 #1
Share this Question
Share on Google+
1 Reply


Nepomuk
Expert 2.5K+
P: 3,112
Hi ashwanisri and welcome to bytes.com!

To do anything with keystrokes directly (rather than the text they input), you will probably want to write a KeyListener. Pasting will not count as the KeyListener will react to keyboard actions.

If you want to find the size of the input into, say, a JTextField you can use the getText() function to get all of the text in the field and then the String#length() function to find out the length of the input.
Oct 9 '13 #2

Post your reply

Sign in to post your reply or Sign up for a free account.