RE: How to restric japanese characters

2001-09-27 Thread Pepelis, Aaron



remember to do it on a KeyRelease.
Otherwise, the character wouldn't be there to remove if 
need be.
aaron

  -Original Message-From: Bharat 
  [mailto:[EMAIL PROTECTED]]Sent: Thursday, September 27, 2001 1:08 
  AMTo: Bharat; [EMAIL PROTECTED]; [EMAIL PROTECTED]; 
  [EMAIL PROTECTED]Subject: Re: How to restric japanese 
  characters
  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( 
  (i32) || ( i126))return 
  true;return false;}
  
  Comments ???
  
  - bharat
  
- Original Message - 
From: 
Bharat 
To: [EMAIL PROTECTED] ; [EMAIL PROTECTED] 
; [EMAIL PROTECTED] 
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 anyapi to do it?or a 
sample code which will help ?

Thanks,
- bharat



RE: [Advanced-java] RE: How to restric japanese characters

2001-09-27 Thread Gart, Mitch



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 

  -Original Message-From: Pepelis, Aaron 
  [mailto:[EMAIL PROTECTED]]Sent: Thursday, September 27, 2001 
  8:55 AMTo: [EMAIL PROTECTED]; [EMAIL PROTECTED]; 
  [EMAIL PROTECTED]Subject: [Advanced-java] RE: How to restric 
  japanese characters
  remember to do it on a 
KeyRelease.
  Otherwise, the character wouldn't be there to remove 
  if need be.
  aaron
  
-Original Message-From: Bharat 
[mailto:[EMAIL PROTECTED]]Sent: Thursday, September 27, 2001 1:08 
AMTo: Bharat; [EMAIL PROTECTED]; [EMAIL PROTECTED]; 
[EMAIL PROTECTED]Subject: Re: How to restric japanese 
characters
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( (i32) || ( i126))return 
true;return false;}

Comments ???

- bharat

  - Original Message - 
  From: 
  Bharat 
  To: [EMAIL PROTECTED] ; [EMAIL PROTECTED] 
  ; [EMAIL PROTECTED] 
  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 anyapi to do it?or 
  a sample code which will help ?
  
  Thanks,
  - bharat
  


RE: How to restric japanese characters

2001-09-27 Thread KC_Eilander




I don't know if I'd mess with key listeners.   The component already has all
the key listeners and cutpaste listeners a guy would need.  Why not filter the
foreign cahracters on the actual text the user is inserting, using something
like this

class EnglishOnlyDocument extends Document {
 public void insertString(int offset, String str,AttributeSet a) throws
BadLocationException {
  //convert str to englishStr by looping on isNonEnglishChar
  super.insertString(offset,englishStr,a);
 }
};

myTextField.setDocument(new EnglishOnlyDocument());







Pepelis, Aaron [EMAIL PROTECTED] on 09/27/2001 06:55:19 AM

Sent by:  Pepelis, Aaron [EMAIL PROTECTED]


To:   [EMAIL PROTECTED], [EMAIL PROTECTED], [EMAIL PROTECTED]
cc:(KC Eilander/MTN/US/3Com)
Subject:  RE: How to restric japanese characters



remember to do it on a KeyRelease.
Otherwise, the character wouldn't be there to remove if need be.
aaron

-Original Message-
From: Bharat [mailto:[EMAIL PROTECTED]]
Sent: Thursday, September 27, 2001 1:08 AM
To: Bharat; [EMAIL PROTECTED]; [EMAIL PROTECTED];
[EMAIL PROTECTED]
Subject: Re: How to restric japanese characters


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( (i32) || ( i126))
   return true;

  return false;
 }

Comments ???

- bharat


- Original Message -
From: Bharat mailto:[EMAIL PROTECTED]
To: [EMAIL PROTECTED] mailto:[EMAIL PROTECTED]  ;
[EMAIL PROTECTED]
mailto:[EMAIL PROTECTED]  ; [EMAIL PROTECTED]
mailto:[EMAIL PROTECTED]
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







remember to do it on a KeyRelease.
Otherwise, the character wouldn't be there to remove if 
need be.
aaron

  -Original Message-From: Bharat 
  [mailto:[EMAIL PROTECTED]]Sent: Thursday, September 27, 2001 1:08 
  AMTo: Bharat; [EMAIL PROTECTED]; [EMAIL PROTECTED]; 
  [EMAIL PROTECTED]Subject: Re: How to restric japanese 
  characters
  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( 
  (i32) || ( i126))return 
  true;return false;}
  
  Comments ???
  
  - bharat
  
- Original Message - 
From: 
Bharat 
To: [EMAIL PROTECTED] ; [EMAIL PROTECTED] 
; [EMAIL PROTECTED] 
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 anyapi to do it?or a 
sample code which will help ?

Thanks,
- bharat




RE: How to restric japanese characters

2001-09-27 Thread Pepelis, Aaron



remember to do it on a KeyRelease.
Otherwise, the character wouldn't be there to remove if 
need be.
aaron

  -Original Message-From: Bharat 
  [mailto:[EMAIL PROTECTED]]Sent: Thursday, September 27, 2001 1:08 
  AMTo: Bharat; [EMAIL PROTECTED]; [EMAIL PROTECTED]; 
  [EMAIL PROTECTED]Subject: Re: How to restric japanese 
  characters
  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( 
  (i32) || ( i126))return 
  true;return false;}
  
  Comments ???
  
  - bharat
  
- Original Message - 
From: 
Bharat 
To: [EMAIL PROTECTED] ; [EMAIL PROTECTED] 
; [EMAIL PROTECTED] 
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 anyapi to do it?or a 
sample code which will help ?

Thanks,
- bharat



RE: [Advanced-java] RE: How to restric japanese characters

2001-09-27 Thread Gart, Mitch



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 

  -Original Message-From: Pepelis, Aaron 
  [mailto:[EMAIL PROTECTED]]Sent: Thursday, September 27, 2001 
  8:55 AMTo: [EMAIL PROTECTED]; [EMAIL PROTECTED]; 
  [EMAIL PROTECTED]Subject: [Advanced-java] RE: How to restric 
  japanese characters
  remember to do it on a 
KeyRelease.
  Otherwise, the character wouldn't be there to remove 
  if need be.
  aaron
  
-Original Message-From: Bharat 
[mailto:[EMAIL PROTECTED]]Sent: Thursday, September 27, 2001 1:08 
AMTo: Bharat; [EMAIL PROTECTED]; [EMAIL PROTECTED]; 
[EMAIL PROTECTED]Subject: Re: How to restric japanese 
characters
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( (i32) || ( i126))return 
true;return false;}

Comments ???

- bharat

  - Original Message - 
  From: 
  Bharat 
  To: [EMAIL PROTECTED] ; [EMAIL PROTECTED] 
  ; [EMAIL PROTECTED] 
  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 anyapi to do it?or 
  a sample code which will help ?
  
  Thanks,
  - bharat
  


Re: How to restric japanese characters

2001-09-26 Thread Bharat



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( 
(i32) || ( i126))return 
true;return false;}

Comments ???

- bharat

  - Original Message - 
  From: 
  Bharat 
  To: [EMAIL PROTECTED] ; [EMAIL PROTECTED] 
  ; [EMAIL PROTECTED] 
  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 anyapi to do it?or a 
  sample code which will help ?
  
  Thanks,
  - bharat
  


Re: How to restric japanese characters

2001-09-26 Thread Ryuichiro Toda

Hello, Bharat.

Try to use this method.

(JTextField object).enableInputMethods(false);

But this code can't disable copy and paste. If you'd like to restrict this
operation, You have to handle the events.

Thanks,

-Ryu
___
Swing mailing list
[EMAIL PROTECTED]
http://eos.dk/mailman/listinfo/swing



Re: How to restric japanese characters

2001-09-26 Thread John Zukowski


To disable copy and past you can remove the operations from the action map 
/ input map.

At 02:26 AM 9/27/2001 +0900, Ryuichiro Toda wrote:
Hello, Bharat.

Try to use this method.

(JTextField object).enableInputMethods(false);

But this code can't disable copy and paste. If you'd like to restrict this
operation, You have to handle the events.


John Zukowski, Strategic Java Consulting
JZ Ventures, Inc. - http://www.jzventures.com
Java Collections - http://www.apress.com/catalog/book/1893115925/
The limits of my language are the limits of my world. - Wittgenstein


___
Swing mailing list
[EMAIL PROTECTED]
http://eos.dk/mailman/listinfo/swing