javalistenerkeyrelease

change the word ي to ی in jtext field


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 م


Solution

  • 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);