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.

Similar Messages

  • GPMC problem: Item has already been added. Key in dictionary: "Key being added:"

    I have the following scenario:    
    I use the Hungarian Windows 7 Professional 64 bit OS
    I use the Group Policy Management Console (GPMC) to connect to a domain controller in a domain environment.
    I try to generate a report for a Group Policy object (GPO) in the GPMC window.
    In this scenario, I experience the following issue:
    I cannot generate the report. Additionally, I receive an error message that resembles the following:  
    Item has already been added. Key in dictionary: "Key being added:"
    I found a KB article for this symptoms:
    http://support.microsoft.com/kb/2254754
    I downloaded the following hotfix to my system:
    Package:
    KB Article Number(s): 2254754
    Language: All (Global)
    Platform: x64
    Location: (http://hotfixv4.microsoft.com/Windows%207/WindowsServer%202008%20R2/sp1/Fix321583/7600/free/415811_intl_x64_zip.exe)
    I unzipped the hotfix. When I started the msu package with my administrator user, the package says the following:
    The update is not applicable for this computer.
    I got the following in my event viewer:
    System
    - Provider
       [ Name]  Microsoft-Windows-WUSA
       [ Guid]  {09608C12-C1DA-4104-A6FE-B959CF57560A}
       EventID 3
       Version 0
       Level 2
       Task 0
       Opcode 0
       Keywords 0x8000000000000000
    - TimeCreated
       [ SystemTime]  2014-09-10T06:31:58.153372600Z
       EventRecordID 2117
       Correlation
    - Execution
       [ ProcessID]  823116
       [ ThreadID]  822724
       Channel Setup
       Computer *******************
    - Security
      [ UserID]  S-1-5-21-1957994488-1606980848-682003330-*****
    - EventData
      UpdateTitle
      ErrorCode 2149842967
      ErrorString
      CommandLine "C:\Windows\SysWOW64\wusa.exe" "C:\Temp\d\Windows6.1-KB2254754-x64.msu" 
    Please help me to solve my problem.
    Thanks in advance,
    Laszlo Farkas

    I don't understand, what do you mean tweak the XML for the filterfile version entry.
    The GPO is the Default Domain Policy. Our AD functional levels (forest, domain) are 2012. If I started GPMC on the domain controller then I do not receive the "Item has already been added..." message, I can open the report succesfully. Our domain
    was on 2003 level before the migration, but we had the same problem ("Item has already been added...")  on Win 7 clients, but on DC with Windows 2003 works well.
    GPMC logging logs the followings when try to open Default Domain Policy on Windows 7 client:
    gpmgmt.log:
    [371c.41c4]  9/10/2014 14:32:21:926  [WARNING] CGPMReport::GenerateReport :ConvertToXml/Html failed with 0x80070057.
    [371c.41c4]  9/10/2014 14:32:21:936  [WARNING] CGPMReport::GenerateReportFromGPO : GenerateReport failed with 0x80070057
    gpmgmtManaged.log:
    Reporting(16568.3)14:32:21 GPO::ConvertToHtml:******The following exception occured:
    *******Message    : Az elemet korábban már felvették. Kulcs a szótárban: „Felhasználói jegy maximális élettartama”; Felvétel alatt álló kulcs: „Felhasználói jegy maximális élettartama”.
    *******StackTrace :
    System.ArgumentException: Az elemet korábban már felvették. Kulcs a szótárban: „Felhasználói jegy maximális élettartama”; Felvétel alatt álló kulcs: „Felhasználói jegy maximális élettartama”.
       a következő helyen: System.Collections.SortedList.Add(Object key, Object value)
       a következő helyen: Microsoft.GroupPolicy.Reporting.Html.Settings.TablePolicySectionTemplate.SetPolicies(IEnumerable policies)
       a következő helyen: Microsoft.GroupPolicy.Reporting.Html.Settings.Windows.Security.SecurityTemplate.AddAccounts(AccountPolicy[] policies)
       a következő helyen: Microsoft.GroupPolicy.Reporting.Html.Settings.Windows.Security.SecurityTemplate.AddSettings(GPOExtensionData securityExtension, GPOExtensionData ipsecExtension, GPOExtensionData saferExtension, GPOExtensionData pkExtension,
    GPOExtensionData wlanSvcExtension, GPOExtensionData dot3SvcExtension, GPOExtensionData napClientMgmtExtension, GPOExtensionData firewallExtension, GPOExtensionData auditExtension, GPOExtensionData srpExtension)
       a következő helyen: Microsoft.GroupPolicy.Reporting.Html.Settings.Windows.Security.SecurityTemplate.SetSecurity(GPOExtensionData securityExtension, GPOExtensionData ipsecExtension, GPOExtensionData saferExtension, GPOExtensionData pkExtension,
    GPOExtensionData wlanSvcExtension, GPOExtensionData dot3SvcExtension, GPOExtensionData napClientMgmtExtension, GPOExtensionData firewallExtension, GPOExtensionData auditExtension, GPOExtensionData srpExtension)
       a következő helyen: Microsoft.GroupPolicy.Reporting.Html.Settings.Windows.WindowsSettingsSectionTemplate.CreateSubsectionTemplates(ArrayList subsections, Hashtable nameExtensionMap)
       a következő helyen: Microsoft.GroupPolicy.Reporting.Html.Settings.Windows.WindowsSettingsSectionTemplate.SetWindowsSettings(IEnumerable extensions)
       a következő helyen: Microsoft.GroupPolicy.Reporting.Html.Settings.MainSettingsSectionTemplate.SetConfiguration(IEnumerable extensionDataList)
       a következő helyen: Microsoft.GroupPolicy.Reporting.Html.Settings.ConfigurationSectionTemplate.AddContent(IEnumerable extensionDataList)
       a következő helyen: Microsoft.GroupPolicy.Reporting.Html.Settings.ConfigurationSectionTemplate.SetConfiguration(GPOUserOrComputerConfig config)
       a következő helyen: Microsoft.GroupPolicy.Reporting.Html.Gpo.GpoReportTemplate.SetGpo(GPO gpo)
       a következő helyen: Microsoft.GroupPolicy.Reporting.GPO.ConvertToHtml()

  • 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

  • Urgent: Error in uploading data in cube after adding new Key figure

    Hi Guys,
    I have added 1 key figure (DEC) to my existing cube. and proceeded as below:
    1. Deleted all data from cube
    2. activated the cube
    3. set Constant 1 for this key figure
    4. activated the transformation
    5. reated a new DTP
    But when i execute it, it gives me error. in updating to infocube ZSDBILL:
    Error while updating to target  ZSDBILL
    Process Terminated.
    all other steps in DTP are succesful like: extraction, error handling and transformation.
    There is no details in long text of these errors.
    Can anyone suggest whats the error stands for or what i am missing.

    Once logout and login back then again activate cube,transformation and run the DTP.
    Hope it helps you

  • Adding new key figures to DP planning area

    I am using APO DP.
    When adding new key figures to a planning area, is there any way of avoiding having to deinitialise and then re initialise the planning area?
    Thanks for any advice on this...

    First of, let us know which version of DP are you using.
    If you are using 7.0, all you need to do is right click on your planning area and select Change Keyfigure setting and you should be able to update the key figures there.
    The below is from SAP help for SAP APO 7.0, you should be able to add the key figure without deinitializing the planning area.
    Key Figure Settings
    Here you can change the properties of the key figures of a planning area, if the planning area has already been initialized. You can also add or delete key figures. However, you can only delete key figures that are no longer used in planning books, data views, macros, or demand forecasts. You can find out in which objects a specific key figure is used with the where-used list.

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

  • Added new key figure in the report

    Experts,
    I have added new key figure in the report .If i display this key figure value in the report it is populating correct value with ERROR(example 22.5 ERROR).The report is on the multiprovider .i have check the value for this in multiprovider it is populating correctly .There is no calculation in the report for this .While extracting in to report i am getting this. Help me to resolve this issue.
    Thanks
    Murali

    Hi,
    I have already created a formula like NODIM(Key field).that only i am using .
    and mapping I did in this way. I went to multiprovider and I have selected this key figure and right click and select (assign) then I have click on create proposal for all infoobjects option.
    Please suggest any thing need to do.
    I am sorry .I did not understand the lonterm solution suggested by you .what is UOM .Please tell me how to map.can you pls tell me clearly please
    Thanks
    Murali

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

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

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

  • Active Screen Corner Customization with added hot keys fails

    Active Screen Corner Customization with added hot keys fails upon restart. So, if my lower left corner is set to activate the screen saver it works. If I add the command key to that operation it works unit I restart the machine than the hot key requirement vanishes, i.e. the screen saver works but not with the required hot key requirement. The system seems to forget all about the hot key association/requirement after restart. Dumping the file below did not change the situation.
    /Library/Preferences/com.apple.preference.desktopscreeneffect.plist

    You might want to try deleting the screen saver preference/plist - look in your home directory:
    /Library/Preferences/com.apple.preference.desktopscreeneffect.plist

  • 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

  • Last added record key for UDO

    Hi,
    I create a UDO , how i get the last added record key after i add document ?
    Please Advise. Thanks

    Hi,
    Or try oCompany.GetNewObjectCode().
    Or if this dosent work try the following.... Before adding the record in the before action = True execute a simple query 
    select max(docentry)  from OINV
    And now store that in a variable and execute the same query after the record is added in the beforeaction = false and check if both are same, if not then u have a new record added.
    Hope it helps,
    Vasu Natari.

  • 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

  • Sales order creation using BAPI is predefined function

    then what is the necessity of creating again?Can any one explain clearly the need of creation of sales order using BAPI

  • Incorrect net due date in FBL5N

    Hi, I have problem with incorrect net due date in FBL5N. I made payment term "120 day end of month". Configuration of payment below. Maturity date whitch is invoice is correct. For example: Invoice was generated on 6th of February and the maturity da

  • How to get list of Users[MailBoxes] in Exchange Server 2013 by using EWS Managed API

    Hi all, I need list of Users exists in my Exchange server 2013 , i.e Mail Box Users login name. I was  created Full Access permissions of all users to Admin user account,  to access each user Mailbox programatically  i need the list of Mailboxes in e

  • Help: HMTL tags displays in PDF

    I created a report and displaying it as PDF. The data coming from the database has HTML tags which is being displayed in the PDF output. I would like these tags to be interpreted instead of displaying. When I display the report as HTML, it works ok (

  • How to archive SharePoint 2013 libraries

    Hello, so we have a site that has quite a bit libraries. Each library is a particular project. They would like to archive the ones that are completed and by archive they want it out of the current site and into an archive site. Is there a way to prog