Unicode problem
Hi,
I wrote this code.
JTextArea textarea = new JTextArea ( );
textarea.addKeyListener (
new KeyAdapter ( ) {
public void keyPressed ( KeyEvent event ) {
int a = event.getKeyChar ( );
if ( a == 97 )
textarea.setText ( "\u0627");
}});
It is working well but with unicode it also displays english character "a" but i just want unicode character. How can i get rid of this problem.
> Hi,
>I wrote this code.
>JTextArea textarea = new JTextArea ( );
>textarea.addKeyListener (
> new KeyAdapter ( ) {
>public void keyPressed ( KeyEvent event ) {
> int a = event.getKeyChar (
> );
>if ( a == 97 )
> textarea.setText ( "\u0627");
>}});
> well but with unicode it also displays english
> character "a" but i just want unicode character. How
> can i get rid of this problem.
Are you trying to display "\u0627" instead of "a" on the textarea?
If that's the case, you just add an escape character "\".
like this.
if ( a == 97 )
textarea.setText ( "\\u0627"); // notice the double backslashes
Good luck
:D