问题描述
为什么不能在jtextfield和JOptionPane.showInputDialog()
中切换输入语言?在我的计算机上可以,但是在其他计算机上,我只能写系统区域设置语言符号.
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.
+ 或 + + 不起作用在应用程序中,但是在应用程序不关注时可以正常工作
+ or ++ 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:我想输入英文符号,但是我只能输入俄语符号... 不只使用对话文本字段
JRE 8;PS: I want to enter English symbols, but I can type only Russian symbols...NOT WORKING ONLY DIALOG TEXTFIELDS
推荐答案
最后...我做到了O_O
Finally...i did it O_O
frame.setVisible(true);
解决了问题,但我不明白为什么?..
solved the problem, but i can't understand why??..
p.s.没有我的comp应用程序上的代码可以正常工作
p.s. without the code on my comp app working nice
这篇关于无法更改jTextField中的输入语言的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!