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

Similar Messages

  • 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>

  • [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 mapping for forms on web

    Presently we are using forms 4.5. We have got costomise key
    mapping for operating through forms. Now we want to start forms
    on web (Intranet). Earlier we use to change key mapping through
    oracle*terminal. I require help in knowing how to customise key
    mapping in forms 6i / oracle 8.1.7.

    Hi,
    Boy, I have some good news to you: Oracle*Terminal is no longer
    needed.
    WordPad (or your favorite text editor) is your tool from now on.
    Keyboard files are located in $ORACLE_HOME\FORMS60.
    Simply ignore the binary file fmrusw.res when you run Forms on
    the Web. FMRWEB.RES is the one that is used, and it's pure ASCII.
    There are some comments in the file itself.
    The keys are the same as the Motif version of Forms.
    If you prefer the Windows keys, simply use FMRPCWEB.RES instead.
    How? Check under $ORACLE_HOME\FORMS60\SERVER for your
    formsweb.cfg, go to User Parameters and replace the
    otherparams=
    line with
    otherparams=term=%forms60%\fmrpcweb.res
    Now, anyone can define the Function-0 till Function-9 key
    combinations, in order to use KEY-F0 till KEY-F9 triggers.
    Hope this helps,
    Pedro das Neves
    [email protected]

  • Key triggers in forms

    How at add key triggers in Forms.For example : When users click function key "F2" then it should save the record.
    Thanks
    Saritha

    hi,
    there are two ways to do it,
    one is to re-map function keys using oracle terminal,
    other is to use triggers that are already associated to the operations that
    are performed by pressing these keys e.g.
    F1 ---> Help
    F9 ---> List of values
    F4 ---> Duplicate record
    you can use these triggers to redefine the function/operation of keys
    by their associated triggers, like if you want 'F4' to save the data,
    you will write 'COMMIT_FORM' or any code you want, on trigger
    KEY-DUPLICATE-RECORD which is fired while 'F4' key is pressed,
    since this trigger is associated with 'Duplicate record' event.
    once you write the code on this trigger at form level, it will perform
    the required operation on activation.
    regards,
    aamir.

  • 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)

  • 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);

  • Primary Key in tabular form is not a number

    I created a table called tblRegions.
    The primary key is RegionCode(VarChar2) - example - USA.
    I then tried to create an updateable Tabular Form using tblRegions, but it won't let me choose the primary key as an updateable field.

    O.K.
    1. create a trigger which will populate a real primary key out of a sequence - search internet
    on triggers and sequences in oracle
    2. use this primary key for tabular form processing
    3. if you need a manually entered pseudo (fake) primary key, you can handle this column
    as any other - tabular form will not complain about it
    4. you may create a constraint on your table, which will take care this column is allways
    populated and unique - this is not the nicest way since it involves processing and the errors
    you gat may not look user friendly. However, this is the most secure and easiest way -
    you don't need to write any code on the application side to handle eventual errors.
    Search internet on constraints.
    5. you may decide to create a manual validation process to fetch the eventual errors
    before you commit the changes to the database. This forum is full of the threads on
    the topic "tabular form" and "manual creation of tabular forms". If you are new to apex,
    you should stay away from that for the first (this is only my opinion).
    Denes Kubicek

  • 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);
    }

  • How to change key on runtime form in application server

    How it is possible reconfigure key on froms in application server ????
    List Values on Client = key "F9"
    List values on Application = key "CTRL + L"
    and so on.....
    can j have the same on client version like apllication ???
    Thank You !!

    Mike,
    the fmrweb.res file in the forms90 directory controls the behavior of Forms function keys. There is a file called fmrpcweb.res in the same directory that you can use to bring back client/server key mapping to Forms on teh Web.
    1. rename fmrweb.res to something different
    2. Make a copy of fmrpcweb.re and name it fmrweb.res
    Frank

  • Why does one openbox key binding break others?

    For some reason, using one of my custom key bindings for openbox breaks some others.  Here's the whole rc.xml file: http://paste.pocoo.org/show/498056/ and the part where the key binding is set:
    <keybind key="XF86TouchpadToggle"><!-- Line 348 -->
    <action name="Execute">
    <startupnotify>
    <enabled>false</enabled>
    </startupnotify>
    <command>/home/user/tpad</command>
    </action>
    </keybind>
    /home/user/tpad:
    #!/bin/bash
    if [[ $1 == "on" ]]
    then echo "turning on touchpad"
    exec synclient touchpadoff=0
    elif [[ $1 == "off" ]]
    then echo "turning off touchpad"
    exec synclient touchpadoff=1
    else
    if (($(synclient | grep TouchpadOff | tail -c 2)==0))
    then echo "turning off touchpad"
    exec synclient touchpadoff=1
    else
    echo "turning on touchpad"
    exec synclient touchpadoff=0
    fi
    fi
    After I press Fn-F3 ("XF86TouchPadToggle"), the following key bindings (all set in rc.xml) are broken: XF86AudioLowerVolume, XF86Display, XF86TouchPadToggle (that's right, it breaks itself).  I've tested this several times.  These keys work when I've just started openbox, but as soon as I press XF86TouchPadToggle, they stop working.
    Does anyone have any idea why, and what can be done to fix it?
    Running the script with the same command as in rc.xml does -not- have the same effect.  Pressing the key with the quoted section from rc.xml commented out does -not- have the same effect.

    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 CAPTURING IN FORM BUILDER

    DOES ANY BODY KNOWS HOW TO CAPTURE KEYS
    IN ORACLE FORM BUILDER..SO THAT WE CAN USE OUR OWN HOT KEYS TO ACCESS DIFFERENT OBJECTS LIKE TAB PAGES THROUGH HOT KEYS.
    IF ANY BODY KNOWS THE PROCEDURE PLEASE TELL ME IN DETAIL
    THANX

    Please don't use all capitals ... that is 'shouting' and is not liked by participants as it is harder to read.
    To answer your question, open forms builder, go to any block, select an item and on the property palette, under functional, click on Access Key - press F1 for help - its all there. I don't know about TABs.

  • Key binding won't work with alt-up and alt-left arrow combined

    I was playing with key binding trying to create a small app where a timer is started with the press of an alt-arrow key and stopped when the key is released. The timers append Strings to a JTextArea telling which alt-arrow key is currently pressed.
    This program works, and in fact if you press a combination of any two keys, both timers will work simultaneously, that is unless you press both up arrow and left arrow together. Can anyone see a bug in the program that explains why it won't work for these two particular keys when combined? Thanks in advance, Pete
    My SSCCE,
    KeyBindingEg.java
    package javaforum2009;
    import java.awt.BorderLayout;
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    import java.awt.event.InputEvent;
    import java.awt.event.KeyEvent;
    import javax.swing.*;
    public class KeyBindingEg {
      // parallel arrays -- sorry
      private static final int[] ARROW_KEYS = {
          KeyEvent.VK_UP, KeyEvent.VK_DOWN,
          KeyEvent.VK_LEFT, KeyEvent.VK_RIGHT };
      private static final String[] ACTION_STRINGS = {
        "Up", "Down",
        "Left", "Right" };
      private static final String PRESSED = "PRESSED";
      private static final String RELEASED = "RELEASED";
      private static final int TIMER_DELAY = 100;
      private JPanel mainPanel = new JPanel();
      private JTextArea textArea = new JTextArea(20, 30);
      public KeyBindingEg() {
        JPanel northPanel = new JPanel();
        northPanel.add(new JLabel("This JTextField has the focus: "));
        northPanel.add(new JTextField(10));
        textArea.setEditable(false);
        mainPanel.setLayout(new BorderLayout());
        mainPanel.add(northPanel, BorderLayout.NORTH);
        mainPanel.add(new JScrollPane(textArea), BorderLayout.CENTER);
        setBindings();
      private void setBindings() {
        int context = JComponent.WHEN_IN_FOCUSED_WINDOW;
        InputMap inputMap = mainPanel.getInputMap(context);
        ActionMap actionMap = mainPanel.getActionMap();
        for (int i = 0; i < ARROW_KEYS.length; i++) {
          // timer is started on key press and stopped
          // on key release.
          Timer timer = new Timer(TIMER_DELAY, new KeyTimerListener(
              ACTION_STRINGS));
    timer.setInitialDelay(0);
    // get input maps for all alt-arrow keys for both key press
    // and key release
    inputMap.put(KeyStroke.getKeyStroke(ARROW_KEYS[i],
    InputEvent.ALT_DOWN_MASK, false), ACTION_STRINGS[i] + PRESSED);
    inputMap.put(KeyStroke.getKeyStroke(ARROW_KEYS[i],
    InputEvent.ALT_DOWN_MASK, true), ACTION_STRINGS[i] + RELEASED);
    // set corresponding actions for the two different key presses above
    actionMap.put(ACTION_STRINGS[i] + PRESSED, new ArrowKeyAction(false, timer));
    actionMap.put(ACTION_STRINGS[i] + RELEASED, new ArrowKeyAction(true, timer));
    @SuppressWarnings("serial")
    private class ArrowKeyAction extends AbstractAction {
    private boolean onKeyRelease;
    private Timer swingTimer;
    public ArrowKeyAction(boolean onKeyRelease, Timer swingTimer) {
    this.onKeyRelease = onKeyRelease;
    this.swingTimer = swingTimer;
    public void actionPerformed(ActionEvent arg0) {
    if (onKeyRelease) {
    swingTimer.stop();
    } else {
    swingTimer.start();
    private class KeyTimerListener implements ActionListener {
    private String actionString;
    public KeyTimerListener(String actionString) {
    this.actionString = actionString;
    public void actionPerformed(ActionEvent arg0) {
    textArea.append(actionString + " pressed\n");
    public JComponent getPanel() {
    return mainPanel;
    private static void createAndShowGUI() {
    JFrame frame = new JFrame("KeyBindings Example");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.getContentPane().add(new KeyBindingEg().getPanel());
    frame.pack();
    frame.setLocationRelativeTo(null);
    frame.setVisible(true);
    public static void main(String[] args) {
    javax.swing.SwingUtilities.invokeLater(new Runnable() {
    public void run() {
    createAndShowGUI();

    camickr wrote:
    I noticed the problem a while ago with a similiar example and asked the same question to which nobody could give an explanation. The same observations seem to apply to your example in that using the numpad arrow keys work without a problem.
    [http://forums.sun.com/thread.jspa?threadID=5176816]
    Yes indeed. I suppose (as always) I should have searched the forum first before asking the question. Thanks for the link and info.
    /Pete

  • 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

Maybe you are looking for

  • Macbook Pro can't connect to WEP 128 bits Router.

    I'll try to list everything here so you can get a clear picture of the situation. First, after all my PCs flatmates connected to our Wireless internet (Amper aw01), I was still struggling. I tried everything, from WEP, to WEP 128 hex, WEP 128 ASCII,

  • Query statement documentation

    Hi, Is there any documentation that helps explain what some of the operators mean in the Query Generator?  For example, our partner set up a query that is used for a user-defined value, but I'm not understanding what some of the operators/conditions/

  • What is happening to my characters?

    Hi all, I'm having trouble with a PDF created from an inDesign file (which is unavailable). The language of the text is Turkish. When you copy the text from the PDF to Word or InDesign, it displays all boxes. What can I do about this? Same with a PDF

  • Newly installed 7200rpm drive is slower...

    Hi. I just installed a 7200RPM - 320GB drive in my macbook pro and took out the previous 5400RPM - 200GB drive. I used carbon copy cloner to clone the original and then put the new one back on... I formatted it as MacOS (Journaled)... It takes about

  • Problème démarrage hp C6180

    Bonjour Mon imprimante, achetée il y a 5 ans, affiche une barre de chargement lorsqu'on la branche, s'éteint au bout d'environ 30 secondes, se rallume, et ainsi de suite. Le bouton "activer" ne marche plus pour allumer ou éteindre l'imprimante. Merci