Answer the question
In order to leave comments, you need to log in
Why does this code only work on windows?
There is a form on which the panel is located jPanel1
, on this panel there are text fields. There is also a switch jToggleButton
. It is necessary that when you click on this switch, the input language on the panel changes. I do it like this:
private void jToggleButtonLangActionPerformed(java.awt.event.ActionEvent evt) {
if(jToggleButtonLang.isSelected()){
jToggleButtonLang.setText("RU");
jPanel1.getInputContext().selectInputMethod(new Locale("ru", "RU"));
} else if(jToggleButtonLang.isSelected()==false){
jToggleButtonLang.setText("EN");
jPanel1.getInputContext().selectInputMethod(new Locale("en", "US"));
}
}
java -version
openjdk version "13.0.2" 2020-01-14
OpenJDK Runtime Environment (build 13.0.2+8)
OpenJDK 64-Bit Server VM (build 13.0.2+8, mixed mode, sharing)
java version "13.0.2" 2020-01-14
Java(TM) SE Runtime Environment (build 13.0.2+8)
Java HotSpot(TM) 64-Bit Server VM (build 13.0.2+8, mixed mode, sharing)
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question