I'm
not sure when KeyRelease would get called. Remember that for
typing
some
Kanji characters a user might physically type and release 2 or more
physical keys on the keyboard, and those keys would be combined into
1
Kanji
character by an input method. You want something that is called
when
the
input method gets done changing the character. Is KeyRelease
the
right
place? Its name would imply that it is not.
The
below isNonEnglishChar() method is right, sort of, although it would
allow
in accented characters in the range of 128-255 which are used in
the
European Latin-1 character sets, but not used in
English.
- Mitch
remember to do it on a
KeyRelease.
Otherwise, the character wouldn't be there to remove
if need be.
aaron
Hi folks,
First, I must thank you for all ur responses.
I have come to a solution which is working so
far.
I have added a keylistener to my JtextField
which is validating each character which is typed or pasted in the
textfiled.
I have written following code to check if the
character is non english.
public static boolean
isNonEnglishChar(char c) { int i = (int)
c; System.out.println("char " +c +" =" +
i); if( (i<32) || ( i>126)) return
true; return false; }
Comments ???
- bharat
----- Original Message -----
Sent: Wednesday, September 26, 2001
9:29 AM
Subject: How to restric japanese
characters
Hi folks,
I want my JTextField to accept only english
characters and it should reject japanese(or any other language)
characters.
Is there any api to do it? or
a sample code which will help ?
Thanks,
- bharat
|