Search code examples
javaswingjtextfield

Cannot change input language in jTextField


Why can't I switch input language in jtextfield and JOptionPane.showInputDialog()? On my computer I can, but on other computer I can write only system locale language symbols.

Ctrl+Shift or Ctrl+Alt+Shift is not working in application, but it is working when app is not focus

Locale.setDefault(Locale.ENGLISH); //tried it
System.setProperty("user.language", "en"); // and it

private void showPasswordWindow() {

    String pass = JOptionPane.showInputDialog(null, "Enter password", "Secure", JOptionPane.WARNING_MESSAGE);
    if (pass == null)
        System.exit(0);
    if (!pass.contains("somepassword"))
        showPasswordWindow();
}

Not working (( password contain English symbols and I can't to enter password (only Russia symbols working)

JRE 8; PS: I want to enter English symbols, but I can type only Russian symbols...NOT WORKING ONLY DIALOG TEXTFIELDS


Solution

  • Finally...i did it O_O

    frame.setVisible(true);
    

    solved the problem, but i can't understand why??..

    p.s. without the code on my comp app working nice