Right now I am making a GUI that allows a user to enter in a word and then the program will conjugate it for the user. I have an option for them to change the input language (from English to Russian). Ideally I would want it to be that when they click the language of their choice, the program would configure the computer to change the language of the keyboard, but I'm not sure if this is possible, instead I just want so that when they click the option, it changes the keyboard the same way as if I were to press control-x (the way I change my languages for my keyboard normally). Here is code that I have so far related to these checkboxes:
final JCheckBoxMenuItem russianOut = new JCheckBoxMenuItem("Russian",rflag); final JCheckBoxMenuItem russianIn = new JCheckBoxMenuItem("Russian",rflag); final JCheckBoxMenuItem englishOut = new JCheckBoxMenuItem("English",eflag); final JCheckBoxMenuItem englishIn = new JCheckBoxMenuItem("English",eflag); //// These methods just make sure only one state is selected at once, not sure if there is a better way of doing this. englishIn.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { if (englishIn.isSelected()) { russianIn.setState(false); } } }); russianIn.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { if (russianIn.isSelected()) { englishIn.setState(false); } } }); englishOut.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { if (englishOut.isSelected()) { russianOut.setState(false); } } }); russianOut.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { if (russianOut.isSelected()) { englishOut.setState(false); } } });
ScreenShot.jpg
I hope this explains what I want, if not just let me know!