Something is eating my key events!

Okay, so I am trying to add some key events to a game. I have added this listener to a class I called Background:
          this.addKeyListener(new java.awt.event.KeyAdapter() {
               public void keyPressed(java.awt.event.KeyEvent e) {
                    System.out.println("A key was pressed");
                    backgroundpanelKeyPressed(e);
               public void keyReleased(java.awt.event.KeyEvent e) {
                    System.out.println("A key was released");
                    backgroundpanelKeyReleased(e);
And then the code for my key events is as follows:
     // pressing the arrow button will allow the ship to move
     public void backgroundpanelKeyPressed(java.awt.event.KeyEvent e) {
     System.out.println ("In Here!");
     switch(e.getKeyCode()) {
     case KeyEvent.VK_LEFT:
     System.out.println("Left key pressed");
     break;
     case KeyEvent.VK_DOWN:
     System.out.println("Down key pressed");     
     break;
     case KeyEvent.VK_UP:
     System.out.println("Up key pressed");     
     break;
     case KeyEvent.VK_RIGHT:
     System.out.println("Right key pressed");     
     break;
               // releasing the arrow button will stop the ship from moving
     public void backgroundpanelKeyReleased(java.awt.event.KeyEvent e) {
     switch(e.getKeyChar()) {
     case KeyEvent.VK_LEFT:
     System.out.println("Left key released");
     break;
     case KeyEvent.VK_DOWN:
     System.out.println("Down key released");
     break;
     case KeyEvent.VK_UP:
     System.out.println("Up key released");
     break;
     case KeyEvent.VK_RIGHT:
     System.out.println("Right key released");
     break;
I can't find the problem with any of that, but something is intercepting my key events before they even get there. Pressing the arrow keys does nothing, but if I hit the spacebar, then it calls Background's constructor.
I searched through the entire code, and nowhere is there any key listener, or any reference to the Background class aside from where I am actually trying to call it.

Does your program always react when you press space? Because if it didn't I'd guess you have problems with the event focus (or whatever it's called). Let's say you add your KeyListener to the Frame/Applet your game is displayed in. At some stage during gameplay a java.awt.Button is pressed. The button will keep the focus and subsequent keypresses will be reported solely to it, so your KeyListener has to listen at the button, too (or you can do a requestFocus() for the component you want to listen to, whenever it looses focus. See FocusListener on this).

Similar Messages

  • Macbook misses some key events for a few seconds

    I have noticed that for last two months or so something strange happens to my Retina MBP. Once in a couple of days it stops responding to some key events. It is like it handles only one keypress out of 4-5. Nothing seems to be wrong with the keyboard and it is not about a particular key or keys. And about 10-15 seconds later everything goes back to normal. I do not see any suspicious messages in the logs, the computer is connected to the power supply...It happens just by itself in the middle of the day, when I am typing.
    Almost looks like some interrupts get lost by the system while it is busy with something else. But I have checked the load level and running processes - nothing interesting there....And whatever it is - it happens during a very short period of time.

    Hi,
    No, I have not returned my MBP yet. In fact, I would rather avoid doing this unless I am convinced if it is a hardware issue. And I do believe it is not. Just recently I have spent some time investigating it and I have found very stroing correlation between the moments when this happens and these messages in the kernel log:
    Jan 13 10:49:54 mbp-wifi kernel[0]: Sandbox: sandboxd(96471) deny mach-lookup com.apple.coresymbolicationd
    Jan 13 10:54:31 mbp-wifi kernel[0]: Sandbox: sandboxd(96499) deny mach-lookup com.apple.coresymbolicationd
    Jan 13 10:54:31 mbp-wifi.home sandboxd[96499] ([96497]): mdworker(96497) deny mach-lookup com.apple.ls.boxd
    Jan 13 10:54:31 mbp-wifi.home sandboxd[96499] ([96498]): mdworker(96498) deny mach-lookup com.apple.ls.boxd
    Jan 13 10:56:32 mbp-wifi.home sandboxd[96504] ([96503]): mdworker(96503) deny mach-lookup com.apple.ls.boxd
    Jan 13 10:56:32 mbp-wifi.home sandboxd[96504] ([96502]): mdworker(96502) deny mach-lookup com.apple.ls.boxd
    And I have also noticed that my Spotlight database gets reconstructed too often, which means it gets corrupted.
    From all this I conclude that it is most likely the software issue and it seems to be linked to spotlight. I saw people reporting similar things. So now I am researching on how to fix it without disabling the spotlight.
    In general, I believe that the quality of Apple software is going down, it is not like 4-5 years ago And Apple does seem to care less and less about it.
    If in your case it happens all the time, not just once in a while, and you see that a particular key has problems - it is possible that we are talking about the different issues and yours might be really about the keyboard.

  • Catching key events in application

    I have a JFrame with a JDesktop containing lots of JInternalFrame with various of components such as JTextFields etc.
    Now, i want to have a "main" listener that will catch key events no matter which component that has focus. For example pressing CTRL+A should produce something in the application no matter which component that has focus.
    How do I implement this in an easy way?

    It doesnt seem to work to add a KeyListener to the JFrame...
    this.addKeyListener(new KeyAdapter(){
                   public void keyTyped(KeyEvent e){
                        System.out.println("KeyTyped()");
                   public void keyPressed(KeyEvent e){
                        System.out.println("KeyTyped()");
              });Adding that to the JFrame gives nothing to System.out when a JTextArea inside an JInternalFrame has focus.

  • Associating key events to a TextBox

    Hello All!
    Can anybody tell me how to associate key events with a TextBox? Something like when a certain key is pressed and released, a certain combinations of characters is inserted e.g. =-)
    I am trying to develop a simple application that allows users to type text with non-English characters, e.g. Russian and for that I have created a canvas and I am using key events i.e. KeyPressed and KeyReleased methods. Using a canvas is a bit insufficient because users cannot move the cursor freely through the text.
    I have read on te web that I can create a CustomeItem and override the KeyPressed methods but I could not do it; I could not find any simlar code example.
    Can anybody help me by providing me with a simple example or suggesting me an alternative way?
    Many thanks in advance

    {color:#008080}*Hello again!*
    I managed to create a CustomItem that overrides KeyPressed method, but now I am having difficulties making my textBox reacts to my keyPressed method.
    The early version of this CustomeItem overrides the KeyPressed method by assigning each key to a certain collection of chars. When a key is pressed, a string of these chars is drawn on the Canvas, which works fine. Now because I want to be able to edit the text, e.g. delete a certain char in the middle of the string, I want to use a TextBox or a TextField. The current problem is that my TextBox does not react to my key presses the way I want (I used setString() method); it reacts to the original key presses which print the original chars (from A through to Z and 1 through to 9).
    Is it possible to set the contents of a TextBox or TextField depending on my key presses? Could you suggest me an alternative way?
    Many thanks in advance!!{color}

  • Object Movement with Key Events

    Hi everybody!
    Im trying to move an object over the screen with keyboard buttons. The problem I have come across with is that I would like to use the right button to move right, up button to move forward, etc. but I cant push, for example, right and up buttons at the same time to make a diagonal movement. How can I solve this?
    Thank you and regards.

    I added key events to a sequence and than check them in the program.
    Something like this:
    class Car extends CustomNode {
        var keys:KeyCode[];
        public override function create(): Node {
            ImageView {
                transforms: [ Translate{ x: bind x, y: bind y }, Rotate{ angle: bind direction}]
                x: -w
                y: -h
                image: Image { url: "{__DIR__}car.png"}
                onKeyPressed: function( e: KeyEvent ) {
                    insert e.code into keys;
                    if(e.code == KeyCode.VK_UP){
                        ds = 2.0;
                    }else if(e.code == KeyCode.VK_DOWN){
                        ds = -2.0;
                    }else if(e.code == KeyCode.VK_LEFT){
                        da = -1.0;
                    }else if(e.code == KeyCode.VK_RIGHT){
                        da = 1.0;
                onKeyReleased: function( e: KeyEvent ) {
                    delete e.code from keys;
        public function move(){
              // check keys
    }

  • KEY events in MIDlets

    Hello all,
    I am basically new to J2ME MIDP development and also new to this
    forum. So apologies if this has already been covered or turns out to
    be a stupid question :) Here goes:
    I am trying to develop a MIDlet where I have a Form to accept certain
    values from the user. This is fairly straightforward and is easy to
    create with the high level Form a and TextField objects.
    Now, I wish to add a functionality to my MIDlet, in which, the user
    can press a specific key.. say the "Select" key or the "Call" key.. at
    any time during the form to start another thread of operation which
    performs something totally different... say for example, the user is
    entering values into the form and in between somewhere he presses this
    specific key and the phone start playing music. I hope you get my
    point.
    Basically I want to listen for key pressed or key held events on a
    Form object. Now I understand that Key events can be found only on the
    low-level Canvas based UIs. So is it possible to do it with Screen class
    elements..?
    Thanks,
    Nik

    You can try to use a CustomItem. What events will be delivered to the custom item depends on the implementation, though. Also these events will be only delivered when the CustomItem is focused.
    Have a look at the J2ME Polish GUI for using CustomItems for MIDP/1.0 devices as well.
    http://www.j2mepolish.org
    Best regards,
    Robert

  • Focus problem using key event

    Hi!
    There is an application I've created uses key event that needs your help.
    As you know, that setting 'Mnemonic' to a JButton object makes the button accessible by a key mentioned in the parameter as the following ->
                   OkButton.setMnemonic(KeyEvent.VK_O);Now, pressing 'Alt' and 'O' keys together will do the same action as the 'OKButton' does.
    But as of me, I think pressing two keys together is not a complete handy job.
    So, is there any code that will do the same, by pressing only the 'O' key ?
    Ok! I know that there is something to be taken care of; that is, if I want the button to react by pressing only the 'O' key the button must be in focus [value returned by the method [code]isFocusable() for the button must return true.]
    Then how the 'Mnemonic' works ?!! When 'Mnemonic' do something, button does not have any focus.
    Only, I press the Alt+O and the work done successfully! No need to take care wherever the focus is. So, is there any way to do alike, where I don't have to manage the focus subsystem?? I would only press the 'O' key and the task will be done.
    Please send a sample code. Thanks!

    I suggest you look into Key Bindings:
    "How to Use Key Bindings"
    http://java.sun.com/docs/books/tutorial/uiswing/misc/keybinding.html
    Here is a short demo program that uses Key Bindings to do what you describe:
    import java.awt.event.ActionEvent;
    import java.awt.event.KeyEvent;
    import javax.swing.*;
    public class PressOTest extends JFrame {
        public PressOTest() {
            super("Press O or C");
            setDefaultCloseOperation(EXIT_ON_CLOSE);
            // Action that will be associated with the OK button and with
            // the 'O' key event
            Action okAction = new AbstractAction("Ok") {
                public void actionPerformed(ActionEvent e) {
                    JOptionPane.showMessageDialog(PressOTest.this, "Ok!");
            // Action that will be associated with the Cancel button and with
            // the 'C' key event
            Action cancelAction = new AbstractAction("Cancel") {
                public void actionPerformed(ActionEvent e) {
                    JOptionPane.showMessageDialog(PressOTest.this, "Cancel!");
            // Register Key Bindings for the 'O' and 'C' keys:
            InputMap im = getRootPane().getInputMap(
                    JComponent.WHEN_IN_FOCUSED_WINDOW);
            ActionMap am = getRootPane().getActionMap();
            im.put(KeyStroke.getKeyStroke( KeyEvent.VK_O, 0 ), "ok");
            am.put( "ok", okAction );
            im.put(KeyStroke.getKeyStroke( KeyEvent.VK_C, 0 ), "cancel");
            am.put( "cancel", cancelAction );
            // Create and add OK & Cancel buttons:
            JButton okButton = new JButton(okAction);
            JButton cancelButton = new JButton(cancelAction);
            Box box = Box.createHorizontalBox();
            box.add( Box.createHorizontalGlue() );
            box.add( okButton );
            box.add( Box.createHorizontalStrut(10) );
            box.add( cancelButton );
            box.add( Box.createHorizontalGlue() );
            getContentPane().add( box );
            setSize(300, 300);
            setLocationRelativeTo(null);
        public static void main(String[] args) {
            new PressOTest().setVisible(true);
    }

  • Handling Enter key event in JTable

    Hi...
    This is particularly for the user "VIRAVAN"...
    I have followed your method ,and got results too.. but the
    processKeyBinding(.. method is called 4 times,same problem addressed by you before, but I didn't understood it...
    Please help me...
    Here is my code...
    protected boolean processKeyBinding(KeyStroke ks, KeyEvent e,int condition, boolean pressed)
    System.out.println("Wait");
    if (ks == KeyStroke.getKeyStroke(KeyEvent.VK_ENTER,0))
    int selRow = getSelectedRow();
    int rowCount = getRowCount();
    int selCol = getSelectedColumn();
    String val =(String)getValueAt(selRow,selCol);
    boolean b= getCellEditor(selRow,selCol).stopCellEditing();
    System.out.println(b);
    System.out.println(rowCount-1 + " "+ selRow + " " + getSelectedColumn());
    if((!val.equals("")) && selRow==rowCount-1)
    System.out.println(rowCount-1 + " "+ getSelectedRow()+ " " + getSelectedColumn());
    blank1 = new String[columns];
    for(int p=0;p<columns;p++)
    blank1[p]="";
    Diary.this.datarows.addElement(blank1);
    // dataModel.fireTableStructureChanged();
    //dataModel.fireTableDataChanged();
    Diary.this.dataModel.fireTableChanged(null);
    else if(ks ==KeyStroke.getKeyStroke(KeyEvent.VK_1,0))
    System.out.println("One One One One ");
    return super.processKeyBinding(ks,e,condition,pressed);

    It's been a while since I looked at the code, but essentially there are three key event types:
    1) key pressed,
    2) key typed,
    3) key released.
    So I would expect the processKeyBind to see all three of them. However, ks==KeyStroke.getKeyStroke(KeyEvent.VK_ENTER,0) is true only when a key typed event is detected (the other types can be ignored by passing it up the food chain where they will eventually be consumed). Now...., if I understand you correctly, you want to terminate edit on the present of Enter key, right? Here is how I'd suggest you do:
       protected boolean processKeyBinding(KeyStroke ks, KeyEvent e, int condition, boolean pressed) {
          if (isEditing()) {
             Component editorComponent=getEditorComponent();
             editorComponent.stopCellEditing();
             return true;
          return super.processKeyBinding(ks,e,condition,pressed);
       }Ok.... now, it appears that you want to do something else also... i.e., add a new row to the table if the editing row is the last row and the editing column is the last column of the last row. You can't do that in the same thread (i.e., you must wait until the update in the current thread is completed). So, what you must do is use the SwingUtilities.InvokeLater, like this:
       protected boolean processKeyBinding(KeyStroke ks, KeyEvent e, int condition, boolean pressed) {
          if (isEditing()) {
             Component editorComponent=getEditorComponent();
             editorComponent.stopCellEditing();
             if (getEditingRow()+1==getRowCount() && getEditingColumn()+1==getColumnCount()) {
                SwingUtilities.invokeLater(new Runnable() {
                   public void run() {
    // put the code for adding new row here
             return true;
          return super.processKeyBinding(ks,e,condition,pressed);
       }OK?
    ;o)
    V.V.
    PS: posted code is untest but should work!

  • Sleutel Bind, fancy key events handler for standalone window managers

    I began using Openbox in my laptop a while ago, and I was amazed by the speed, customization and simplicity it provides. After I started customizing my desktop I noticed that some of the special keys (TouchpadToggle, Volume, PrintScreen, etc) didn't worked at all. There are some applications for the Volume keys to work, but not for keys like touchpad-toggle and print-screen. Of course, there's a workaround for each case using simple scripts, but I wanted something a little more fancy, so I made:
    Sleutel Bind
    It's made in C and provides key events handling for:
    XF86TouchpadToggle
    Print (prtsc key)
    It makes use of libnotify to display states ( touchpad enabled/disabled, screenshot taken, etc) and imlib2 (a very popular library, probably already installed in your system) to grab the screenshots. Almost all other keys are covered already by another application, but if needed, more key events will be added in the future.
    Feel free to post your thoughts about Sleutel Bind, it's my first contribution to the community.
    How to use
    Once installed just run the command as a normal user.
    If using openbox, place the following command in the "~/.config/openbox/autostart" file:
    sleutelb &
    Links
    AUR
    github
    Last edited by DanielRS (2013-03-01 21:58:35)

    mgmillani wrote:
    I believe it must have been a bug and it was fixed, since print screen now works as expected. I'm using xmonad version 0.11-9, with ghc version 7.8.3.
    davama wrote:
    Note: for my print key to be recognized by xev i had to hold the ctrl key. that way it was not registered by xmonad. Also for xev command i use
    xev | grep -A2 --line-buffered '^KeyRelease' | sed -n '/keycode /s/^.*keycode \([0-9]*\).* (.*, \(.*\)).*$/\1 \2/p'
    Nice, that seems to be useful. Thanks!
    @LQYMGT
    Do you still have issues with the latest version? Otherwise I will mark this thread as solved.
    well, still do not work... But I do not want to try it any more...So you can mark.

  • Unable to find Key Events when there are multiple Commands

    Hi,
    I've developed a simple J2ME Appln containing 3 commands
    for ex- Exit,Help and Info(all with same priority).
    As there are 3 commands, Exit command is present at the left and the other two namely Help and Info have been listed under Menu and this Menu command is presented at the right.
    My MIDlet class has extened MIDlet and implemented CommandListener. Using CommandAction(), I'm able to generate action for Command press and i've also created a nested class which extends Canvas so, using keyPressed and keyReleased, I'm able to find the Key Press Events.
    Now, my appln needs to find just the key press events. After i press the Menu command, the two commands namely Help and Info are listed. In tht screen, I need to find out whether any other key events are being generated but my keyPressed and keyReleased are not being called.
    Please provide me solution ASAP.

    I'm going to make a few assumptions:
    1. The menu you're describing is the automatically generated one caused by having more than two commands.
    2. The subclass of Canvas is the currently active Displayable (otherwise you won't get any key events at all).
    If this is the case (and someone correct me if I'm wrong), key events are being handled by the phone's subsystem to drive the menu, which means there's no way to get them. The way I've approached this kind of problem is to create my own menu painting and handling code and incorporated it into the Canvas. Then, make one Command called 'Menu' and have it invoke your custom menu code.
    I realise this isn't an ideal solution, but it's something.

  • Capture desktop key event to control my screen capture app

    I want to write a screen capture program to capture screen when I am playing fullscreen game or other desktop window application. But the java screen capture program can only receive key or mouse event when it is focused. So how do I capture key event when I am focusing other app or fullscreen app?
    Do I have to use JNI and call some OS specific API. My target OS is WinXP. Help or suggestions are appreciated!!

    Hi All,
    I was wondering if there is a way to capture the top-most
    window or dialog box. This is something that will
    generally be running outside of the JVM....We,
    as programmers, need a Rectangle instance that describes the area
    of interest to be captured (i.e., location and size).
    Thus, a routine that interfaces to the Native windowing system (Toolkit?)
    might look something like:
    Rectangle rect = tk.getRectangleForTopMostComponent();
    Does anything like this exist?
    Thanks!
    - DocJava

  • Surprising behaviour ..key pressed key event

    Hello,
    I am experiencing a supprising event key press issue. I have written below code in which my code getting called even though I didnt press any of the key,
    _entryPane.getTextArea().addKeyListener(new KeyAdapter() {
                 public void keyPressed(KeyEvent e) {             
                           doSendTypeStatus();
                     if(e.getKeyChar()==KeyEvent.VK_ENTER) {
                        if(e.isControlDown()) {As shown above , doSendTypeStatus() function getting called automatically ,i.e. with out being pressed any of the key on key board .
    Thread [AWT-EventQueue-0] (Suspended (breakpoint at line 82 in LivehelpTextEntryPanel$1))     
         LivehelpTextEntryPanel$1.keyPressed(KeyEvent) line: 82     
         TextAreaPane$MyTextArea(Component).processKeyEvent(KeyEvent) line: 5058     
         TextAreaPane$MyTextArea(JComponent).processKeyEvent(KeyEvent) line: 2388     
         TextAreaPane$MyTextArea(Component).processEvent(AWTEvent) line: 4909     
         TextAreaPane$MyTextArea(Container).processEvent(AWTEvent) line: 1569     
         TextAreaPane$MyTextArea(Component).dispatchEventImpl(AWTEvent) line: 3615     
         TextAreaPane$MyTextArea(Container).dispatchEventImpl(AWTEvent) line: 1627     
         TextAreaPane$MyTextArea(Component).dispatchEvent(AWTEvent) line: 3477     
         DefaultKeyboardFocusManager(KeyboardFocusManager).redispatchEvent(Component, AWTEvent) line: 1713     
         DefaultKeyboardFocusManager.dispatchKeyEvent(KeyEvent) line: 627     
         DefaultKeyboardFocusManager.preDispatchKeyEvent(KeyEvent) line: 831     
         DefaultKeyboardFocusManager.typeAheadAssertions(Component, AWTEvent) line: 741     
         DefaultKeyboardFocusManager.dispatchEvent(AWTEvent) line: 592     
         AgentFrame(Component).dispatchEventImpl(AWTEvent) line: 3506     
         AgentFrame(Container).dispatchEventImpl(AWTEvent) line: 1627     
         AgentFrame(Window).dispatchEventImpl(AWTEvent) line: 1606     
         AgentFrame(Component).dispatchEvent(AWTEvent) line: 3477     
         EventQueue.dispatchEvent(AWTEvent) line: 456     
         EventDispatchThread.pumpOneEventForHierarchy(int, Component) line: 201     
         EventDispatchThread.pumpEventsForHierarchy(int, Conditional, Component) line: 151     
         EventDispatchThread.pumpEvents(int, Conditional) line: 145     
         EventDispatchThread.pumpEvents(Conditional) line: 137     
         EventDispatchThread.run() line: 100     can any one please help me in resolving this issue. I am implementing typing status feature in my chat application. but due to this key event behavior , my implementation is failing completely.
    Looking for reply.
    thanks in advance
    Ani

    What is the question?
    doSendTypeStatus() function getting called automatically ,i.e. with out being pressed any of the key on key board .No, it is getting called whenever a key is pressed in the text area. It can be any key, but a key must be pressed. If you claim not to be pressing any keys, please print out the event.
    // wrong:
    if(e.getKeyChar()==KeyEvent.VK_ENTER) {
    // right:
    if(e.getKeyCode()==KeyEvent.VK_ENTER) {You should compare codes with codes, not chars
    Lastly you might want to use a document listener instead, so you also get notified when the user pastes something in the text area.

  • How to catch key events

    Hello!
    I have a component which extends JPanel. Now I dynamically add a JTextField as a child to this component. The problem is: when the textfield has focus, how can I get key events in my panel before the textfield gets them (and maybe intercept them so that the textfield doesn't get them at all)?
    Background: the component is a self written table and the textfield is an editor. Now I have to make sure that when I am editing and press e.g. "cursor up", that not the textfield will get this key event but the table (which should traverse the current cell then ...)
    The problem is: I cannot change the textfield (extend it or something) because a possible solution has to work with any java awt "Component" (or at least with JComponent).
    Any help very appreciated.
    Michael

    Hello,
    implement the keyListener interface for the Extended component...
    and in Keypressed method
    keyPressed(keyEvent){
    // do all ur reuirements here
    //and comsume the keyEvent...
    hope this helps

  • KeyListener Problems with Directional Key events

    Here's the problem: If I press and hold the up and right directional keys (non-numpad) and then press the left directional key, it doesn't recognize that I pressed left (i.e. "LeftKeyPressed" is not printed). What's up? Is there something I don't know about directional keys that makes them special like this? Thanks.
    Here's the code:
    public void keyPressed(KeyEvent e)
         if(e.getKeyCode() == 37)
                   left = true;
                   System.out.println("LeftKeyPressed");
         if(e.getKeyCode() == 38)
              forward = true;
         if(e.getKeyCode() == 39)
              right = true;
    }

    So you want to hold the up key and the right key down and then also press the left key down, but the left key will not activate when the up and right key are pressed and held down first.
    You might be at the point that you should ask yourself -- why do I want to have a left key event happen when I already have a right and up going on. It's obviously not for directions, you cannot go left and right at the same time.

  • Which components catch a key-event?

    Hello,
    I've a question. I've a panel with severall sub-panels with textfield-editors. These have listeners to respond on a enter-key pressed event.
    When I input an illegal value somewhere, I invoke a messagedialog with a warning message. The problem is that when I press enter , the oke-button of the messagepane has the focus, the enter-key pressed event is also caught by my first panel with all the editors and shows the same message dialog again. Kinda like a loop.
    I thought that key-pressed event only where caught by the component/frame which has the focus, or am I wrong.
    Can anyone help me out here?
    Much Thanks
    Hugo Hendriks

    Normally an ActionListener is installed to an OK button, not a KeyListener. Check if you have implemented the same error handling in two places!
    Generally you can "eat" key events by e.consume(), maybe this helps:
    public void keyPressed(KeyEvent e) {
    if (e.getKeyCode() == KeyEvent.VK_ENTER) {
    // ... do some error handling on ENTER
    e.consume();
    I think then the Frame GUI will no get the key event anymore. A modal JDialog has a local event queue (to be modal), but maybe it forwards events to the main queue ...

Maybe you are looking for

  • Logical standby database issue?

    Hi, I created a logical standby database on the same server as primary database. then I transited the old primary DB to standby DB,                             old standby DB to primary DB. and "alter system switch logfile" in new Primary DB. execute

  • How can i use function from microsoft DLL in an ABAP program?

    Hi Is there a way to use a function from a standard DLL file in an ABAP progrm ???? The dll is stored in c:\winnt\sttem32. Do i need to upload the dirver to the ECC server? do i need to put it some Tcode before i use it in my program? i tried to fine

  • Java application hangs on I/O

    Hello, Could use some help as I've been racking my brain and going crazy. I have a Java application who's sole purpose in life is to monitor a QFS file system for when it goes bad. This main process kicks off a thread(we'll call it thread A) which li

  • Regarding accesing integration builder tool for java proxy generation

    Hi Abapers,     How can I access integration builder tool to generate java proxy via SAP XI server in my ECC 5.0?     Please give me the clear idea of that. regards Subash

  • Problems downloading free trial of creative cloud

    i cannot download the free trial version of creative cliud on my imac. each time i try i get an error message to check my internet connectivity and firewall settings.  i do not believe i have any firewall as this is a new imac bought only 3 days ago