How can I check whether a pressed key is printable or not in a key press event in java?
How to check a pressed key is printable or not?
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;
}
© 2022 - 2024 — McMap. All rights reserved.