ALT_GRAPH_MASK

I'm having a strange problem with the alt_gr modifier on win98 using sun jdk1.3. Shift, ctrl and alt are working fine, but the alt_gr doesn't seem to correspond to its value in class InputEvent.
KeyEvent.ALT_GRAPH_MASK in InputEvent (and KeyEvent) has this value:
32d (or 100000b)
When the alt_gr key is pressed, the modifier getModifier() in KeyEvent returns this:
10d (or 1010b)
So there's absolutely no correspondence between the two.
Anybody else with this problem? And maybe a fix for it?

Solved!
In the latest version of jdk1.3 (jdk1.3.0_2) the problem has been solved. ALT_GRAPH_MASK equals the getModifiers() method.
But remember, all previous versions (jdk1.1, jdk1.2, jdk1.3.0) do have this bug.

Similar Messages

  • JTextField: How to modify keybinding / keyboard response?

    Hello Experts,
    For a certain programming purpose, is there a way to modify keyboard response?
    I have created a JTextField txtSample. When it gets the focus, I want it to behave as following:
    1. When user presses '+' key, instead of printing '+' in the text field, I want to do some actions and the '+' is not printed.
    2. When user presses 'a' key, instead of printing 'a' in the text field, I want 'o' to be printed.
    I have done the following for the first purpose, but it doesn't work:
    Action addTrans = new AbstractAction() {
         public void actionPerformed(ActionEvent e){
              System.out.println("User has pressed + keypad");
    txtSample.getInputMap().put(KeyStroke.getKeyStroke(KeyEvent.VK_PLUS, 0), "addTrans");
    txtSample.getActionMap().put("addTrans", addTrans);Any advice would be greatly appreciated.
    Patrick

    camickr,
    First amazing thing, the first time I clicked on the link
    Works fine is this example:
    http://forums.sun.com/thread.jspa?forumID=57&threadID=622030 it gave an error message.
    Second amazing thing, I checked on the API of KeyStroke
    getKeyStroke
    public static KeyStroke getKeyStroke(char keyChar)
        Returns a shared instance of a KeyStroke that represents a KEY_TYPED event for the specified character.
        Parameters:
            keyChar - the character value for a keyboard key
        Returns:
            a KeyStroke object for that key
    getKeyStroke
    public static KeyStroke getKeyStroke(int keyCode,
                                         int modifiers)
        Returns a shared instance of a KeyStroke, given a numeric key code and a set of modifiers. The returned KeyStroke will correspond to a key press.
        The "virtual key" constants defined in java.awt.event.KeyEvent can be used to specify the key code. For example:
            * java.awt.event.KeyEvent.VK_ENTER
            * java.awt.event.KeyEvent.VK_TAB
            * java.awt.event.KeyEvent.VK_SPACE
        The modifiers consist of any combination of:
            * java.awt.event.InputEvent.SHIFT_DOWN_MASK
            * java.awt.event.InputEvent.CTRL_DOWN_MASK
            * java.awt.event.InputEvent.META_DOWN_MASK
            * java.awt.event.InputEvent.ALT_DOWN_MASK
            * java.awt.event.InputEvent.ALT_GRAPH_DOWN_MASK
        The old modifiers
            * java.awt.event.InputEvent.SHIFT_MASK
            * java.awt.event.InputEvent.CTRL_MASK
            * java.awt.event.InputEvent.META_MASK
            * java.awt.event.InputEvent.ALT_MASK
            * java.awt.event.InputEvent.ALT_GRAPH_MASK
        also can be used, but they are mapped to _DOWN_ modifiers. Since these numbers are all different powers of two, any combination of them is an integer in which each bit represents a different modifier key. Use 0 to specify no modifiers.
        Parameters:
            keyCode - an int specifying the numeric code for a keyboard key
            modifiers - a bitwise-ored combination of any modifiers
        Returns:
            a KeyStroke object for that key
        See Also:
            KeyEvent, InputEventThere is no indication that one method consume the keystroke, while the other does not. Now, I understand that keybinding can prevent the key from reaching the model.
    And last, yes, you are right. It would be better to use DocumentFilter to serve
    When user presses 'a' key, instead of printing 'a' in the text field, I want 'o' to be printed.Thanks for all your effort to guide me and sorry for the misunderstanding,
    Patrick

  • Key emulation

    Hi all,
    I m searching for a way to emulate a key from the keyboard (such as alt+a).
    Using java librairies.
    I think this is possible with AWTKeyStroke but I d'ont know how to manage this.
    Is there on other way to do that ?
    Thanks
    Septentryon

    Well good suggestion,
    I tried it. It runs with movemous but not with
    robot.keyPress(KeyEvent.ALT_GRAPH_MASK);
    robot.keyPress(KeyEvent.VK_F4);
    robot.keyRelease(KeyEvent.ALT_GRAPH_MASK);
    robot.keyRelease(KeyEvent.VK_F4);
    robot.keyRelease(KeyEvent.VK_PRINTSCREEN);What do you expect that to do?

Maybe you are looking for

  • Good bye and good riddance Verizon

    Dear Verizon Wireless, I have been having a MAJOR issue with your billing dept. No one seems to be able to help me. I have had at least 6 contacts with them and each time, I have been given a different answer, and quite frankly, I am fed up. On March

  • I Need to Write the current Date and Time

    I need to write the current date and time to calculate the spend time in each instruction. What is the instrucion? Thanks. MIGUEL ANGEL CARO [email protected]

  • Firmware Maddness for the Zen Mic

    Is it just me or is this firmware business out of control for the Zen Micro? Having a .0 series and a 2.0 series at the same time is creating way too much confusion! Aren't MP3 players supposed to be replacing portable CD Players and Cassette Players

  • Changing the homepage of 150 Macintosh's remotely?

    I need to change the homepage of about 150 macintosh's, running snow leopard. I am hoping to accomplish remotely, either with a Unix command or pushing the corrected plist to them. == User Agent == Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_4; en

  • JCEA - can I take part 1 in India and part 2 & 3 in US/UK ?

    Hi, I am planning to take JCEA. My question is - can I take first part (exam) in India and rest (assignment + essay) in other country? I will purchase each part in country where I will plan to take exam. Thanks, Jags