Key Binding issues

Hi, I'm developing a java applet game and am having trouble using the key bindings of the JComponent class.
The game starts off with a screen that the user enters some game parameters via text fields and combo boxes. When the user clicks the start button they are then taken to the game screen. Here the users should be able to use the keys a, w, s, and d as controls. Originally I had KeyListeners added directly to the JApplet that worked fine for game control however due to changes in the program structure I need a way to be able to listen from the game display component itself.
I have the following code in a custom class GamePanel extending JPanel that displays the game play itself (its actually nested within another custom class extending JPanel):
this.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke("W"), "Forward");
this.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke("S"), "Backward");
this.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke("A"), "Left");
this.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke("D"), "Right");
this.getActionMap().put("Forward", userInputListener.forwardAction);
this.getActionMap().put("Backward", userInputListener.backwardAction);
this.getActionMap().put("Left", userInputListener.leftAction);
this.getActionMap().put("Right", userInputListener.rightAction);I've tried with the WHEN_ANCESTOR_OF_FOCUSED_COMPONENT but that didn't work either. I also tried plain KeyListeners but had no luck.
I'm assuming the problem stems from focus issues because of the text fields, combo boxes, and/or buttons so I added a focus listener to the JApplet and GamePanel to test my theory. The applet gets focus when first clicked on however once the text fields etc. are clicked it is not regaining focus even after methods requestFocus or requestFocusInWindow are called.
I could definitely be wrong about the focus stuff but any input would be greatly appreciated!
Thanks,
- Nat

it is not regaining focus even after methods requestFocus or requestFocusInWindow are called.It works for me using:
panel.addMouseListener(new MouseAdapter()
     public void mousePressed(MouseEvent e)
          e.getComponent().requestFocusInWindow();
});I added the above code to this posting:
http://forum.java.sun.com/thread.jspa?forumID=57&threadID=5149852
If that doesn't work then you can also try using:
panel.setFocusable( true );
panel.setRequestFocusEnabled( true );Otherwise a SSCCE as suggested above is required.

Similar Messages

  • Curious key binding issue with Openbox

    I'm learning about setting up key bindings for actions in Openbox. One of things that I wanted to do is to have the root-menu and client-list-combined-menu set to keyboard shortcuts. This part I borrowed from a post in the forums and it does exactly what it's supposed to do:
    <!-- Keybindings for root menus -->
    <keybind key="W-z">
    <action name="ShowMenu">
    <menu>client-list-combined-menu</menu>
    </action>
    </keybind>
    <keybind key="W-x">
    <action name="ShowMenu">
    <menu>root-menu</menu>
    </action>
    </keybind>
    The issue comes when I don't want to select something in the menu. Esc will clear it just like it should. But, The Caps Lock key on my system which is remapped to Esc won't. It works like an escape key everywhere except here. Any ideas on why?

    Inxsible wrote:Does this happen only in the vim window ? ...
    No, it happens all the time. It can be the first thing that I do when the computer boots, and it still doesn't work the way that I'd expect.
    If it helps, this is what xev is reporting for Escape:
    KeyPress event, serial 35, synthetic NO, window 0x1200001,
    root 0x13b, subw 0x0, time 23124448, (89,89), root:(1163,782),
    state 0x10, keycode 9 (keysym 0xff1b, Escape), same_screen YES,
    XLookupString gives 1 bytes: (1b) "
    XmbLookupString gives 1 bytes: (1b) "
    XFilterEvent returns: False
    KeyRelease event, serial 35, synthetic NO, window 0x1200001,
    root 0x13b, subw 0x0, time 23124600, (89,89), root:(1163,782),
    state 0x10, keycode 9 (keysym 0xff1b, Escape), same_screen YES,
    XLookupString gives 1 bytes: (1b) "
    XFilterEvent returns: False
    And for Caps_Lock:
    KeyPress event, serial 35, synthetic NO, window 0x1200001,
    root 0x13b, subw 0x0, time 23132024, (89,89), root:(1163,782),
    state 0x10, keycode 66 (keysym 0xff1b, Escape), same_screen YES,
    XKeysymToKeycode returns keycode: 9
    XLookupString gives 1 bytes: (1b) "
    XmbLookupString gives 1 bytes: (1b) "
    XFilterEvent returns: False
    KeyRelease event, serial 35, synthetic NO, window 0x1200001,
    root 0x13b, subw 0x0, time 23132144, (89,89), root:(1163,782),
    state 0x10, keycode 66 (keysym 0xff1b, Escape), same_screen YES,
    XKeysymToKeycode returns keycode: 9
    XLookupString gives 1 bytes: (1b) "
    XFilterEvent returns: False

  • CR4E 2.0 key binding

    First of all, thanks a lot for this great piece of software. With the new version 2.0, supporting changes of POJO datasources in existing reports, I'm happy to the max - well, nearly
    There's one thing: it seems, that the CR4E somehow assigned some key bindings for itself, that mix up with my own. To name some, the HOME key (setting the text cursor to the beginning of the actual line in the editor) seems to be taken over by the CR4E to go to the "first page". Same with the "END" key (to jump to the end of a line in the editor), it's assigned by the CR4E to "last page" - all of this even then, if I'm not in the "Crystal" Perspective" and have no report file open.
    I wonder, whether it's really only me, that noticed this behaviour and how to fix his. I don't need a key in the Crystal Designer to jump to any page, but I can't live without jumping to the beginning or end of a line in my editors in eclipse.
    I haven't found a topic mentioning this problem, neither with the search function nor by clicking through the most recent posts or reading the notes about the new CR4E on the website.
    Any hints from the experts around here?
    TiA
    Markus

    Windows -> Preferences then select General -> Keys
    Find the "Line Start" command.  You should see it defined as Binding=Home, When=Editing Text.
    Copy that comand using "Copy Command".
    In the copy, specify When=Editing Java Source.
    This will bind Home to Line Start command when editing Java code. 
    Do similar for Line End, and also for other Edit Sources.
    My Eclipse Ganymede specifies Home as Crystal Reports Designer First Page and Editing Text Line Start, so it couldn't choose which to use when editing source.
    Didn't notice this issue till you mentioned it, since I had configured my Eclipse for "Emacs" key binding
    Sincerely,
    Ted Ueda

  • Gnome Activities Key-binding.

    I have a steelseries keyboard with norwegian layout. The issue is that the "left super" key is replaced with a "steelseries" key for controlling media. Gnome-shell uses the "left super" key for lauching activities, but it does not exist, and that's the issue.
    Unity uses both left and right button for that, which I think is optimal, couse then I can just use the "right super" key for launching activities.
    In gnome-shell on Ubuntu i used caps lock for launching activities, which i configured in "System settings" --> "Region and Language" --> "Layouts" --> "Options..." --> "Caps Lock key behavior" --> "Make Caps lock an additional Super"
    This does not work with my gnome install on arch, so i have configured my key binding for activities to be "Left Alt + Space", which is not optimal and very annoying.
    Both the "right super" key and "caps lock" solution will work for me, but i don't know how to make it work on Arch...
    This is my xorg.conf
    ## xorg.conf
    ## GRAPHICS CARD
    Section "Device"
    Identifier "ATI Radeon HD4850"
    Driver "radeon"
    Endsection
    ## KEYBOARD
    Section "InputClass"
    Identifier "Keyboard"
    Option "CoreKeyBoard"
    Option "XkbLayout" "no"
    Option "XbkRules" "xorg"
    Option "XkbModel" "pc105"
    EndSection
    Thanks for any help!

    I found this by Googleing
    gnome extra keys
    http://www.redhat.com/archives/rhl-list … 03825.html
    It looks like the command to run the gnome search tool is "gnome-search-tool".  So just have a key binding conf that runs that command when you hit whatever button you want.
    If this doesn't help, don't give up on the Google hunt, try other variations of extra, like custom keys instead, and maybe you'll find a hit.  You might find an answer much faster than waiting for one in a forum.
    I would normally try this on my own machine, but I don't have Gnome installed. :]
    Good luck.

  • [SOLVED]openbox key binding hell

    hello everyone I'm having 2 issue setting up new key bindings and I hope someone here can help me I want it to add W-f binding  to open my file manager of choice(pcmanfm) below I will list the two issue and post my rc.xml and all the out put from xev for the f key an the output of xmodmap -pm
    issue #1) when I add a key with obkey the bind I add works but all the others openbox key binds stop working here I'm at a lost after trying it a few times and getting the same result I decide to just edit the xml file here where the second issue begins
    issue #2) when edited the rc.xml to add the key bind I want it I did exactly as the wiki sead but it didn't work so I start looking around and and found out that I can pass the hex value for the key converting the keycode that I get form xev output below
    KeyRelease event, serial 41, synthetic NO, window 0x1a00001,
    root 0xac, subw 0x0, time 1106315, (109,-274), root:(897,143),
    state 0x0, keycode 41 (keysym 0x66, f), same_screen YES,
    XLookupString gives 1 bytes: (66) "f"
    XFilterEvent returns: False
    after doing that seeing that it didn't work ether I found out about the "default" bind the keyboard below is the output
    xmodmap: up to 4 keys per modifier, (keycodes in parentheses):
    shift Shift_L (0x32), Shift_R (0x3e)
    lock Caps_Lock (0x42)
    control Control_L (0x25), Control_R (0x69)
    mod1 Alt_L (0x40), Alt_R (0x6c), Meta_L (0xcd)
    mod2 Num_Lock (0x4d)
    mod3
    mod4 Super_L (0x85), Super_R (0x86), Super_L (0xce), Hyper_L (0xcf)
    mod5 ISO_Level3_Shift (0x5c), Mode_switch (0xcb)
    as I read in one of the forum post in the cruchbnag page the mod4 is the for the window key or super
    so I cahnge the W key on my binding for Super_L and that didn't work ether a this point i'm at a lost of what to do or how to fix it blow is the keyboard part of my rc.xml
    <keyboard>
    <chainQuitKey>C-g</chainQuitKey>
    <!-- Keybindings for desktop switching -->
    <keybind key="C-A-Left">
    <action name="GoToDesktop">
    <to>left</to>
    <wrap>no</wrap>
    </action>
    </keybind>
    <keybind key="C-A-Right">
    <action name="GoToDesktop">
    <to>right</to>
    <wrap>no</wrap>
    </action>
    </keybind>
    <keybind key="C-A-Up">
    <action name="GoToDesktop">
    <to>up</to>
    <wrap>no</wrap>
    </action>
    </keybind>
    <keybind key="C-A-Down">
    <action name="GoToDesktop">
    <to>down</to>
    <wrap>no</wrap>
    </action>
    </keybind>
    <keybind key="S-A-Left">
    <action name="SendToDesktop">
    <to>left</to>
    <wrap>no</wrap>
    </action>
    </keybind>
    <keybind key="S-A-Right">
    <action name="SendToDesktop">
    <to>right</to>
    <wrap>no</wrap>
    </action>
    </keybind>
    <keybind key="S-A-Up">
    <action name="SendToDesktop">
    <to>up</to>
    <wrap>no</wrap>
    </action>
    </keybind>
    <keybind key="S-A-Down">
    <action name="SendToDesktop">
    <to>down</to>
    <wrap>no</wrap>
    </action>
    </keybind>
    <keybind key="W-F1">
    <action name="GoToDesktop">
    <to>1</to>
    </action>
    </keybind>
    <keybind key="W-F2">
    <action name="GoToDesktop">
    <to>2</to>
    </action>
    </keybind>
    <keybind key="W-F3">
    <action name="GoToDesktop">
    <to>3</to>
    </action>
    </keybind>
    <keybind key="W-F4">
    <action name="GoToDesktop">
    <to>4</to>
    </action>
    </keybind>
    <keybind key="W-d">
    <action name="ToggleShowDesktop"/>
    </keybind>
    <!-- Keybindings for windows -->
    <keybind key="A-F4">
    <action name="Close"/>
    </keybind>
    <keybind key="A-Escape">
    <action name="Lower"/>
    <action name="FocusToBottom"/>
    <action name="Unfocus"/>
    </keybind>
    <keybind key="A-space">
    <action name="ShowMenu">
    <menu>client-menu</menu>
    </action>
    </keybind>
    <!-- Keybindings for window switching -->
    <keybind key="A-Tab">
    <action name="NextWindow">
    <finalactions>
    <action name="Focus"/>
    <action name="Raise"/>
    <action name="Unshade"/>
    </finalactions>
    </action>
    </keybind>
    <keybind key="A-S-Tab">
    <action name="PreviousWindow">
    <finalactions>
    <action name="Focus"/>
    <action name="Raise"/>
    <action name="Unshade"/>
    </finalactions>
    </action>
    </keybind>
    <keybind key="C-A-Tab">
    <action name="NextWindow">
    <panels>yes</panels>
    <desktop>yes</desktop>
    <finalactions>
    <action name="Focus"/>
    <action name="Raise"/>
    <action name="Unshade"/>
    </finalactions>
    </action>
    </keybind>
    <!-- Keybindings for window switching with the arrow keys -->
    <keybind key="W-S-Right">
    <action name="DirectionalCycleWindows">
    <direction>right</direction>
    </action>
    </keybind>
    <keybind key="W-S-Left">
    <action name="DirectionalCycleWindows">
    <direction>left</direction>
    </action>
    </keybind>
    <keybind key="W-S-Up">
    <action name="DirectionalCycleWindows">
    <direction>up</direction>
    </action>
    </keybind>
    <keybind key="W-S-Down">
    <action name="DirectionalCycleWindows">
    <direction>down</direction>
    </action>
    </keybind>
    <!-- Keybindings for running applications -->
    <keybind key="W-e">
    <action name="Execute">
    <startupnotify>
    <enabled>true</enabled>
    <name>Konqueror</name>
    </startupnotify>
    <command>kfmclient openProfile filemanagement</command>
    </action>
    </keybind>
    <keybind key="Super_L-0x29">
    <action name="Execute">
    <commnad>pcmanfm</commnad>
    </action>
    </keybind>
    </keyboard>
    the last is the is the one I add it I use both the Super_L and the hex valu of the f key to see if will work but it doesn't also as long I add them by hand all the defaults key bind keep working the second i use obkey they stop working as mention in issue 1
    Last edited by gozes (2012-01-01 06:27:00)

    You have a misspelling, twice on the same line: commnad should be command.
    If that doesn't fix it, try using a full path:
    <!-- pcmanfm -->
    <keybind key="W-F">
    <action name="Execute">
    <command>/usr/bin/pcmanfm</command>
    </action>
    </keybind>

  • Key binding in Forms 6i

    Hi All,
    I have a problem with key binding. I have tried different permutations of changing the key binding using the Oracle Terminal on FMRUSW.RES FILE to no avail. I have edited the keys of windows-sqlforms normal and used USER DEFINED KEY 2, etc but when I try to generate the file it gives the error 'failed to find action for user defined key 2 for an entry in "normal" in sqlforms. I have even gone to the extent of merely changing the bindings of the old entries to see whether it would work. It would give no error when generating but in the application the triggers did not work. I have even changed the Product Actions by inserting the code in the actions column but without any success.
    What I really want is for example to execute the key triggers in the application e.g. F2 would fire the trigger 'execute query', F3 to fire trigger 'copy', etc.
    I will appreciate any help I can get. Please note that I have gone through the numerous materials on the subject but they have not solved the problem.
    Thanks.
    Tunde

    Hi,
    I coded the key mapping as follows:
    I created a menu item. To call the code, you have to give a name for an accelerator key in the property palette for the menu item e.g. "start_menu".
    Let's say, to invoke the menu item, you have to press "Ctrl+E". So you have to set the key mapping in your *.res-file like this:
    69 : 2 : "Ctrl+E"           : 85 : "start_menu"
    Explaination:
    69: Code for "Ctrl+E"
    2: Java Modifier Number for "Control"
    85: Forms function number ("User Defined Key 3", look at the file I send to you !)
    I don't know, if that's the solution, because you wanted to map F1, F2...., but it shouldn't be a problem to switch my solution to F-keys. But perhaps, some of the Forms functions (e.g. F7 for Enter-Query-Mode) won't work then.
    Hope this helps.
    Regards,
    Markus

  • Attachment binding issue in workflow

    Hi All,
    I have used FM 'SAP_WAPI_ATTACHMENT_ADD ' in method of my workflow. Here after executing this FM i m getting id of the attachment for this workitem. But now i need to assign this to  '_Attach_Objects' of workflow container. so please help me for this binding issue. which i need to bind from method to> task to> workflow. so from next step onwards in workflow i will get that attachment.
    Smit Shah

    Hi,
    1) In the T.code SWO1, you have to create a custom method for the BO, there execute that method and check whether it working fine
    2) Then goto  T.code PFTC and Create a Task (Task no. will generate automatically), then call this method and generate the binding
    3) Goto  T.code SWDD and call that Task by assigning that Task no. and assign the binding
    Then test your workflow.
    For the Binding see this [link|http://help.sap.com/saphelp_nw04/helpdata/en/c8/bfc39b0fc57a49a0291378f8be0cd6/frameset.htm].
    Regards,
    Surjith

  • Adding a Key Binding Globally (to an entire JFrame)

    Hi, all. I'm trying the ever-so-common task of adding a global key binding to my little Swing app. I just wrote a very basic image converter for an obscure multi-frame format and one of the users requested that I add a simple feature: when control-N is pressed, the a new document is created (just as if the user had selected New from the File menu).
    I've read the Swing keybinding tutorial and I've tried to write a method to neatly contain the operation. The method is as follows:
        public static void setKeystrokeForAction(JFrame jframe, KeyStroke keystroke, Action action)
            jframe.getRootPane().getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).put(keystroke, action.getValue(Action.NAME));
            jframe.getRootPane().getActionMap().put(action.getValue(Action.NAME), action);
        }This doesn't seem to work. I was under the impression that this would somehow allow any component focused in the frame to respond to the specified KeyStroke (in this case, control-N) and react by executing the Action provided (in this case, an action which calls the new document method in my application). However, I press control-N with various focused components and nothing happens.
    I know that the Action is sound because selecting the File : New item (which uses the same Action object) works just fine. The KeyStroke is constructed as follows:
    KeyStroke.getKeyStroke(KeyEvent.VK_N, KeyEvent.CTRL_DOWN_MASK)What am I missing?
    Thanks!

    Don't know why its not working. Its works fine for me in this example:
    http://forum.java.sun.com/thread.jspa?forumID=57&threadID=312780
    Although the example uses WHEN_IN_FOCUSED_WINDOW I also tested it with WHEN_ANCESTOR... and it still worked fine.

  • [SOLVED] Looking for a terminal command or key binding to exit Openbox

    I've searched the forums and googled, but I haven't been able to find the answer.  I'm sure I've missed it somewhere...
    I start my openbox session with 'startx' from the command line. I would like a terminal command or a key-binding to be able to exit openbox and return to the command line. I just don't like using the menu with my notebooks touchpad.  I just can't seem to figure out what command is used. The menu.xml file lists the command as "Exit", but typing that in a terminal just exits the terminal.
    Any help appreciated.
    Last edited by badfrog88 (2010-09-05 19:08:43)

    gorky wrote:ctrl-alt-backspace won't do the job?
    IIRC, it's disabled by default in xorg-server 1.7 and newer.
    @ badfrog88
    Ctrl + C will kill (almost) any running app you point it to.
    Last edited by karol (2010-09-05 19:17:29)

  • How key binding in Oracle Forms works?

    Hi guys,
    This is my first time @ this forum.
    I tried to find documentation about this but no luck.
    I am new to Forms. Nevertheless, I know that in order to use key binding in Forms, fmrweb.res file is used. BUT....
    How the Form( client) know which key was pressed? Does the forms gets it from windows?
    I mean ,what kind of info(http request??) is sent over network to server ?
    Lets assume F12 is assigned as 113 key value.
    What happens over network when user clicks on keyboard F12?
    Is there any info about this?
    I read that when client accesses Forms application for the first time, java run-time classes bundled in JAR files are downloaded to client JRE cache. These files include frmall.jar, frmwebutil.jar and jacob.jar. This tells me there no conf files for client , only .class
    To summarize my complicated question:) : I would like to know how my form knows what was pressed, before it send this data to server, which will read fmrweb.res and understand in the end the actual functionality
    Thanks for your replies

    Let me start by saying "Welcome to the Oracle Forums" and more specifically to "Forms". Before going much further, I would recommend that you review the following page as it will help you to get the most valuable replies possible.
    http://blogs.oracle.com/shay/entry/10_commandments_for_the_otn_fo
    As for what you are asking, I am guessing that there is a more specific, underlying question you are asking. Is how Forms capturing key strokes internall really important? What are you trying to accomplish? The simple answer from a fairly high level is that the java client applet (frmall.jar) monitors for client activity (mouse clicks, keyboard actions, etc) and sends that information to the server. It is the Forms runtime process (frmweb) which is running on the mid tier that reacts (as required) to that event. So, it is the runtime process using the resource file and not the client. Also, you referred to frmwebutil.jar and jacob.jar. These files are only used for WebUtil enabled forms. The only file required for all applications is frmall.jar
    If your real question is, how to I doing something in my application as a result of a particular key press, then the answer to most of that is in the comments listed in fmrweb.res. Here is one example of how it works.
    Let say you wanted to have your app do something custom when F2 is pressed. In fmrweb.res, assign F2 is assigned to Forms function. Specifically a custom function. This would be one of the ones shown as "Function X". You can choose any one you like as these are not related to the key. In other words, the key F2 has no direct relationship with "Function 2" unless you decide to set it up that way. "Function 2" refers to the trigger in your form. So let's related the F2 key with Function 6. You entry in fmrweb.res would look something like this: 113  : 0 : "F2"  : 88 : "Function 6" Here's how this entry works:
    <blockquote>1. The 113 directly relates to the java awt key event 113
    2. The 0 indicates that no modifiers are to be included. This means that the only key pressed will be F2. There will be no Shift, Control, etc
    3. The next entry ("F2") is what is displayed when "Show Keys" is displayed from your form's help.
    4. The 88 is the internal ID number used by Forms which relates to an event. In this case, 88 refers to Function 6 or in other words, a KEY-F6 trigger in your form.
    5. The last entry is the description of what the key does. In other words, item 3 above indicates which key to press (to the user) and this entry explains what it does or represents. So in this case, you can change the wording "Function 6" to whatever you'd like.</blockquote>
    Again, most of this is explained in the comments of fmrweb.res although I understand it can be confusing.
    This to remember:
    <blockquote><li>You cannot have duplicate java events (with modifier). So be careful, if you duplicate an entry, likely nothing will happen. You can duplicate a java event so long as it has a modifier different from other similar entries. In other words, you can have a F2, Shift+F2, etc
    <li>Some keys are restricted by the OS and cannot be overridden. Exactly which ones will depend on your client OS and version. For example, on most Windows versions, you will not be able to override F1 however in some cases it may work. It will just depend on exactly which version you are using.</blockquote>

  • Key shortcut, issue, typing something in editing code and changing language going directly to snippets.

    Key shortcut, issue, typing something in editing code and changing language going directly to snippets.
    So the problem is that I have to click in the editing code again to write in different language, which it didn't happened before.
    Just in case of shortcut keys collision I completly removed the shortcut of snippets from shift+F9, nothing changed. I really can't understand why when I press Alt+Shift to change language it goes straight to the snippets.
    If anyone can help would save me from nervous breakdown! 
    Thanks,
    GKD

    Since this appears to be a "just started happening" issue, have you tried clearing the program cache?
    Deleting a corrupted cache file
    That tends to catch a lot of weird behaviors and straighten them out.

  • Remove the Enter key binding from a JPopupMenu

    Hi,
    Does anyone know how to remove the Enter key binding from a JPopupMenu?
    So when the popupmenu is showing and you type Enter, nothing should happen and the menu should stay where it is.
    I have tried:
    popup.getActionMap().put("enter", null);
    popup.getInputMap().put(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0), "enter");but the popup always disappears.
    Any ideas?
    Cheers,
    patumaire

    First of all, that is not the proper way to "remove" a key binding. Read the Swing tutorial on [How to Use Key Bindings|http://java.sun.com/docs/books/tutorial/uiswing/misc/keybinding.html#howto] for more information.
    However, we still have a couple of problems:
    a) the input map is dynamically built as the popup menu is displayed
    b) the input map is built for the root pane, not the popup menu
    The following seems to work:
    popup.show(...);
    InputMap map = getRootPane().getInputMap(JTable.WHEN_IN_FOCUSED_WINDOW);
    map.put(KeyStroke.getKeyStroke("ENTER"), "none");
    KeyStroke[] keys = map.allKeys();
    for (int i = 0; i < keys.length; i++)
         KeyStroke key = keys;
         Object action = map.get( key );
         System.out.println(key + " : " + action);

  • Latitude e7450 - Repeating Keys/Debouncing Issue is present in this model too

    Not sure how to get attention to this, as I do not think Dell is aware of this problem since this model was only released a month ago.  The repeating keys/debouncing issue described here  , is present in this new model Latitude e7450 in both bios A00 and A01.  Please make this bug known, so that Dell is able to fix it in a bios update!

    So, I also found and posted in this thread  about the issue with the E7450
    and basically that is the aggregation of all the posts on this repeating keys/debouncing issue on ALL affected models.  Honestly as a developer, I'm pretty shocked at how bad Dell support really is.  I've been lucky enough to never have any hardware issues until now...
    They chose to have a forum for their customer service, fine; that works with many other companies. But they should have at least split the forums into laptop series,by model number, have a bug tracker and paid more than 1 guy to relay issues to the engineering team.. This is ridiculous and utter chaos reading through these threads and it is enough to make me question buying a high priced Dell ever again.  Like many people I went with Dell Latitude after Lenovo created that awful macbook-like clickable touchpad, but it looks like their 2015 models are bringing back hardware left/right click buttons again so that might be my next purchase.

  • Key binding confusion

    I'm trying to use key bindings to navigate a table and do a few other things and I'm totally lost. The first picture in this thread gives you an idea of what my application looks like
    http://www.enginuity.org/viewtopic.php?t=8
    In the JInternalFrame, I have a JToolBar with some JButtons and JTextFields and a JPanel with an array of DataCells (extends JLabel). Basically, I want the arrow keys to move the data cell selection when any component is selected except the text fields.
    If the user types a number and neither text field is selected, I want the second text field to clear and take focus. When the user presses <enter> in that textfield, I want a method to be called (the same as clicking on the set value button). It'd also be nice if pressing a non-numeric (or dot) would not be input in those text fields.
    I'm confused though. How many key bindings do I need to use, and on what component? How many ActionMaps and InputMaps do I need? Do I need to make custom Actions? Sun's key binding "tutorial" just isn't making any sense to me.

    and a JPanel with an array of DataCells (extends JLabel). Use a JTable, it supports navigation using the arrow keys.
    Here is a simple example with InputMaps and ActionMaps:
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    public class PanelActions extends JFrame implements FocusListener
         LayoutManager layout;
         public PanelActions()
              layout = new GridLayout(0, 10);
              JPanel  panel = new JPanel( layout );
              setContentPane( panel );
              Action rightAction = new AbstractAction()
                   public void actionPerformed(ActionEvent e)
                        JComponent c = (JComponent)e.getSource();
                        c.transferFocus();
              for (int i = 0; i < 30; i++)
                   String text = String.valueOf(i);
                   JLabel label = new JLabel( text );
                   label.setFocusable( true );
                   label.addFocusListener( this );
                   panel.add( label );
                 InputMap im = label.getInputMap(JLabel.WHEN_FOCUSED);
                   KeyStroke right = KeyStroke.getKeyStroke(KeyEvent.VK_RIGHT, 0);
                   im.put(right, "right");
                   label.getActionMap().put(im.get(right), rightAction);
         public void focusGained(FocusEvent e)
              JLabel l = (JLabel)e.getSource();
              System.out.println(l.getText());
         public void focusLost(FocusEvent e) {}
         public static void main(String[] args)
              PanelActions frame = new PanelActions();
              frame.setDefaultCloseOperation( EXIT_ON_CLOSE );
              frame.pack();
              frame.setLocationRelativeTo( null );
              frame.setVisible(true);
    }

  • Serious Keyboard Key Mapping Issue

    Hi there everyone...
    Yesterday evening, while i was watching a movie on my Macbook, i accidentally pressed the command button, and all of a sudden the movie stopped playing.
    After some research on the internet, I activated the keyboard palette, and found out that several keys had issues
    1. The left command button behaved as if i was pressing command + . (period key)
    2. The right command button behaved like command + up arrow key
    3. The up arrow key like issue 2 above
    4. The period key like issue 1 above
    p.s. the up arrow and period keys arent working at all, they just behave as i explained above
    Since it had to do with a modifier key, i tried to change the modifier key settings, but even though i tried accessing the modifier key settings through preferences, no pop-up window opened and no change could be made.
    Even though i tried a PRAM zapping, nothing happened because as i understand it, the system doesnt recognise the shortcut, since together with command,option,p,r, the period key is seen pressed as well.
    If anyone can help please do!
    Thanks for your time everyone,

    So I booted from the install disk.... Didnt now what exactly to do, so i use the terminal to see if the problem with the keys persisted... And unfortunately it did.... Didnt know what to do next so i quit and booted again...
    But i restarted my macbook, only to boot into hardware test mode, to see if the problem really is on hardware side.
    I am running an extended test, but poking around a bit, i noticed that the up arrow key worked fine...
    Waiting now to see the results from the test, which i will post after it's finished.

Maybe you are looking for