How can I check whether a pressed key is printable or not in a key press event in java?
Asked
Active
Viewed 780 times
1 Answers
4
Check this topic.
public boolean isPrintableChar( char c ) {
Character.UnicodeBlock block = Character.UnicodeBlock.of( c );
return (!Character.isISOControl(c)) &&
c != KeyEvent.CHAR_UNDEFINED &&
block != null &&
block != Character.UnicodeBlock.SPECIALS;
}