Aly Ahmed Mohamed Aly Ahmed Mohamed - 4 months ago 57
Java Question

Change system language in java programming.

there is way to change system language in java programming. I do java dictionary app so I use two jtextfield one for English and other for Arabic I want when focus in English jtextfield system language convert to english and like in jtextfield arabic there any way to do that ?


Try using this methods:

public void setArabic(JTextField txt) {
    txt.getInputContext().selectInputMethod(new Locale("ar", "SA"));

public void setEnglish(JTextField txt) {
    txt.getInputContext().selectInputMethod(new Locale("en", "US"));