Results 1 to 2 of 2
  1. #1
    Pavlo is offline Member
    Join Date
    Dec 2012
    Posts
    1
    Rep Power
    0

    Question Keyboard indicator

    Hi all!

    I'm trying to make keyboard indicator for Win XP/7 (just like in windows tray) which will be moved with mouse pointer. I make JFform with JLabel.
    Also I find how to know what current language is by:

    Java Code:
            import java.awt.im.InputContext;
            ...
            InputContext KeyboardLayout = InputContext.getInstance();
            String lang = KeyboardLayout.getLocale().getLanguage();
    The question is how to let know the application about language change and reload label text? (notice that user can change input language in any other applications by predefined keys or mouse). I find some info ... may be use windows API? or may be Java is not good for such tasks? What direction to choose?

    Source:

    Java Code:
    package showlayout3;
    
    import java.awt.*;
    import java.awt.im.InputContext;
    import javax.swing.border.*;
    import javax.swing.JFrame;
    import javax.swing.JLabel;
    
    public class ShowLayout3 {
        public static void main(String[] args) {
            JFrame frame = new JFrame ("Layout");
            InputContext keyboard_layout= InputContext.getInstance();
            String lang = keyboard_layout.getLocale().getLanguage();
            
            final JLabel label = new JLabel(lang);
            label.setBorder(new LineBorder(Color.blue,1));
            
            label.setFont(new Font(label.getFont().getName(),Font.PLAIN,64));
            frame.getContentPane().add(label);
            
            frame.setSize(300,300);
            frame.setLocation(300,800);
            frame.setUndecorated(true);
    
            frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            frame.pack();
            frame.setVisible(true);
        }
    }
    Last edited by Pavlo; 12-26-2012 at 07:02 PM.

  2. #2
    DarrylBurke's Avatar
    DarrylBurke is offline Forum Police
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,453
    Rep Power
    20

    Default Re: Keyboard indicator

    Moved from New to Java

    db
    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

Similar Threads

  1. Help with this keyboard GUI
    By stuckonjava in forum AWT / Swing
    Replies: 10
    Last Post: 02-19-2012, 04:50 AM
  2. End-Of-File indicator problem?
    By mjzhaochenyi in forum New To Java
    Replies: 4
    Last Post: 10-02-2011, 03:45 PM
  3. jxtable sort indicator
    By new2java2009 in forum New To Java
    Replies: 0
    Last Post: 07-18-2011, 07:04 PM
  4. Keyboard
    By UJJAL DHAR in forum New To Java
    Replies: 4
    Last Post: 01-29-2011, 03:26 PM
  5. indicator ajaxtags
    By Peter in forum JavaServer Pages (JSP) and JSTL
    Replies: 2
    Last Post: 07-04-2007, 07:51 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •