Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 1 of 1

Thread: Changing Keyboard Language using Java in GUI (Eclipse and Mac)

  1. #1
    Junior Member
    Join Date
    Dec 2012
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Changing Keyboard Language using Java in GUI (Eclipse and Mac)

    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!
    Last edited by curmudgeon; December 24th, 2012 at 12:21 PM. Reason: code tags corrected


Similar Threads

  1. Replies: 1
    Last Post: October 26th, 2012, 12:42 PM
  2. Replies: 5
    Last Post: September 12th, 2011, 08:24 AM
  3. Changing my GUI help
    By Xrrak in forum AWT / Java Swing
    Replies: 13
    Last Post: August 10th, 2011, 03:11 PM
  4. Eclipse on Mac
    By Cuju in forum Java IDEs
    Replies: 6
    Last Post: March 19th, 2010, 09:29 PM
  5. setting the compiler for eclipse mac os x
    By etidd in forum Java IDEs
    Replies: 2
    Last Post: January 29th, 2010, 10:18 AM

Tags for this Thread