change the word ي to ی in jtext field

120 Views Asked by At

i need change the word ي to ی in jtext field if user write ي in jtext field that word must be change to ی like this شیمي = شیمی ي = ی I think I should use the listener and keyrelease but I do not know how?! or change ی to م for me? شیمی = شیمم every time user use ی in my jtext replace م

1

There are 1 best solutions below

0
On BEST ANSWER

i find this way

    String a = jTextField1.getText();
    String b = a.replace("ي", "ی");
    jTextField1.setText(b);

    String c = jTextField1.getText();
    String d = c.replace("ك", "ک");
    jTextField1.setText(d);