Why AbstractAction sometimes work sometimes doesn't work ?

In my program I need to use the Esc key, so I did the following to implement it, sometimes when I started the program and press the Esc key, it works as I intended, but other times after the program starts and I pressed the Esc key, no response, but if I minimize the window and restore it, and then I press the Esc key, it would work fine. Has anyone encountered similar problem ?
    Action Escape_Action=new AbstractAction("Escape Action")                             // Create an action object
      public static final long serialVersionUID=26362862L;
      // This is an instance initializer; it is executed just after the constructor of the superclass is invoked
        // The following values are completely optional
        // Set tool tip text
        putValue(Action.SHORT_DESCRIPTION,"Tool Tip Text");
        // This text is not directly used by any Swing component; however, this text could be used in a help system
        putValue(Action.LONG_DESCRIPTION,"Context-Sensitive Help Text");
        // Set an icon
        Icon icon = new ImageIcon("icon.gif");
        putValue(Action.SMALL_ICON, icon);
        // Set a mnemonic character. In most look and feels, this causes the specified character to be underlined. This indicates that if the
        // component using this action has the focus and In some look and feels, this causes the specified character in the label to be underlined
        putValue(Action.MNEMONIC_KEY,new Integer(java.awt.event.KeyEvent.VK_A));
        // Set an accelerator key; this value is used by menu items
        putValue(Action.ACCELERATOR_KEY,KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE,0));
      public void actionPerformed(ActionEvent evt)                                       //  This method is called when the action is invoked
    // Register keystroke
    this.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE,0),Escape_Action.getValue(Action.NAME));
    // Register action
    this.getActionMap().put(Escape_Action.getValue(Action.NAME),Escape_Action);
    Frank

You need to create a "Short, Self Contained, Compilable
and Executable, Example Program (SSCCE)",
see http://homepage1.nifty.com/algafield/sscce.html,
that demonstrates the incorrect behaviour, because I can't
guess exactly what you are doing based on the information provided.

Similar Messages

  • I bought a new macbook pro 13inch retina and sometimes the charger doesn't work properly, I dont know if its the charger or my laptop?

    I bought a new macbook pro 13inch retina and sometimes the charger doesn't work properly, I dont know if its the charger or my laptop? i always have to take the charger in or out for it to work ... -.-

    Apple Portables: Troubleshooting MagSafe adapters
    http://support.apple.com/kb/TS1713

  • Why tethering with USB cable doesn't work after IOS6.0 update?

    why tethering with USB cable doesn't work after IOS 6.0 update?

    Try updating the carrier settings, if that doesn't do it try following along with this Apple doc -> iOS: Troubleshooting Personal Hotspot

  • Why clipping path postponed from a photoshop in indesign at operation of addition of the new channel by means of work path doesn't work

    why clipping path postponed from a photoshop in indesign at operation of addition of the new channel by means of work path doesn't work 

    Please elaborate the issue and Supply pertinent information for quicker answers:
    The more information you supply about your situation, the better equipped other community members will be to answer. Consider including the following in your question:
    Adobe product and version number
    Operating system and version number
    The full text of any error message(s)
    What you were doing when the problem occurred
    Screenshots of the problem
    Computer hardware, such as CPU; GPU; amount of RAM; etc.

  • Why some eMac DVD SuperDrive doesn't work?

    Why some eMac DVD SuperDrive doesn't work?
    They have a limited hours life, or some DVD or CD can damage them?
    Thank you

    Hopefully some day I will find the answer for this question.

  • Why an automatic sign in doesn´t work?

    Why an automatic sign-in doesn´t work? I have chosen to the choose: "Sign in me automatically when Skype starting".

    Hi Nadia,
    Although a slightly different issue, could you try solutions 1 and 2 from here: http://helpx.adobe.com/creative-cloud/kb/creative-cloud-application-recognizing-available. html
    Thanks,
    - Dave

  • Hi everyone, I have a computer linked to my iPAD through itunes.  Then my Computer crashed and had to get  a new one. How do I get rid of the old computers link on ipad and get it on new computer bcos is wont work! (doesn't work) PLZ HELP :(

    Hi everyone, I have a computer linked to my iPAD through itunes.  Then my Computer crashed and had to get  a new one. How do I get rid of the old computers link on ipad and get it on new computer bcos is wont work! (doesn't work) PLZ HELP

    what do you mean the old computers link?
    my ipad is sycned with my computer but nowhere is there a link
    and if I connected it with a new computer and set it to sync it would replace all my data with the data from the new computer

  • When I open my MacBook lid sometime the screen doesn't work!

    Hi, I have found that recently, when I open the lid of my MacBook Pro it does not wake from sleep properly. The sleep light goes out and I can hear the hard drive spinning, but the display does not work.
    I have to turn off the mbp and restart it, then it will work. It works sometime, it tends to be when I leave it closed for too long that it does this.
    Can anyone help??
    Thanks
    Tom

    I am having this same problem. The computer itself is awake, but the display stays blank. I can restart it by pressing the power button then 'R' then 'return'. This just starting happening frequently recently for me. It may be the result of one of the more recent security updates.

  • Why in spanish the keyboard doesn´t work Q or A letter

    That side doesn´t work sometimes in games, anybody that the same problem?

    I get erratic loss of input capability into my Touch. On some days in the browser ,the W key doesn't work but the adjacent Q or E keys work just fine when I slide my finger back and forth. A few hours later, it works just fine. Last night I was entering a new location in the weather, the keyboard worked fine but after a search, it would not let me click on the new location to set it up. I could get a blue background but it would not click to complete the entry. Again, I tried it 20 min later and it worked just fine. Same thing on iTunes, there are occasions when the screen is unresponsive to my input and other times when it works just fine. I have one of those plastic covers sold at the Apple store to protect the screen and maybe that's the problem. However, recent rollerblade fall proved the worth of the protector as the cover was deeply scored but the screen was fine (was erratic before fall, not caused by fall). Touch is not jailbroken. Don't want to give up the protection film but I'm not sure whether there is a problem with my iTouch or just with my touch.

  • Why custom logon error messages doesn't work in WAS 7.0, EP 7.0?

    I managed to get custom error messages in WAS 6.40 / EP 6.0.
    I'm using JAAS custom Login module for user authentication and from there different Login Exceptions are thrown.
    I have modified logon.par file to display different error messages like "Logon ID is empty", "Password is empty", "Your user ID or password could not be validated.  Please check and try again."
    When i copy the same code into my working environment i.e WAS 7.0 / EP 7.0, it doesn't work, message always was "User Authentication Failed". Do anyone knows the reason why i was like that?
    Can you please explain exactly when the custom login module gets executed after the user clicks on "Logon" Button.
    In logon.par file i have not seen any code to execute JAAS - custom logon module. PLease explain exact execution flow ..
    Thanks in advance ..
    MMK

    Your card reader might be finicky like mine. Figure out which device your card reader is at (from what I'm reading probably sdb), then attempt to mount /dev/sdb to any location. If your card reader is like mine, this mount will fail but you'll find you now magically have /dev/sdb1, /dev/sdb2, etc devices, which will successfully mount... oddness, but it "just works" so I'm happy
    Note that if you plug a card into a slot that is to the kernel, for example, /dev/sda2, then try to mount /dev/sda1, this will (obviously) fail, so be sure to try mounting all the devices that magically appear (if any do).
    -dav7

  • Sound doesn't work(only in firefox). why? sound doesn't work(only in firefox). why? (adobe flash player doesn't work even thought it's installed)

    sound doesn't work (only in firefox). adobe flash player doesn't work correctly, thought it's installed. can't solve the problem. i need Sound.
    == This happened ==
    Every time Firefox opened
    == don't know

    What does the Adobe test page say?
    http://www.adobe.com/software/flash/about/
    Start Firefox in [[Safe Mode]] to check if one of your add-ons is causing your problem (switch to the DEFAULT theme: Tools > Add-ons > Themes).
    See [[Troubleshooting extensions and themes]] and [[Troubleshooting plugins]]
    If it does work in Safe-mode then disable all your extensions and then try to find which is causing it by enabling one at a time until the problem reappears.
    You can use "Disable all add-ons" on the ''Safe mode'' start window.
    You have to close and restart Firefox after each change via "File > Exit" (on Mac: "Firefox > Quit")
    See also [[No sound in Firefox]] and [[Video or audio does not play]]

  • After updating to iOS 8.0.2 in my iPhone 5S, why does automatic landscape orientation doesn't work?

    I recently updated to iOS 8.0.2 in my iPhone 5S. Since that update, landscape orientation doesn't work for any application. I have ensured that the Portrait Orientation lock is Off.

    I have a workaround, if you lock then unlock the orientation lock it seems to work again.

  • Why Position:Relative from CSS doesn't work at Safari 5.03?

    If you watch my web page: http://clubdeleonesst.tk
    I designed a ComboBox and have some problems with position relative. I used jQuery to create it, you could watch the original example here:
    http://www.marghoobsuleman.com/jquery-image-dropdown
    And I have been watching that the transparency from Flash doesn't work too. I hope you can solve these bugs.
    Message was edited by: FANMixco
    Message was edited by: FANMixco

    The "disappearing" affect you describe is not normal. You may need to reinstall Safari.
    First, try removing the Apple cookies from your Safari Preferences>Security>Cookies panel. Also, go to your Safari Menu and Empty cache. Then try to log-on to Apple Discussions.
    Also, regarding the "disappearing" effect, try Safari from another User Account.
    Here is guidance from Apple on how to set up the account. You can ignore step 7 in the article.
    Also, on the system preference>Accounts panel, click on "log-in" options. There, select "fast user switching". This allows you to go back and forth between user accounts via an icon in your Menu Bar at the top of the computer screen.
    Log-on to the new account and start Safari. If Safari is stable in the new account, then your problem is specific to your regular user account. Otherwise, similar response means a system-wide problem.
    Post back with results.

  • Why my weather widget suddenly doesn't works?

    My weather widget working fine before yesterday but suddenly doesn't works when i choose in these locations singapore, malaysia and taiwan... what's wrong with it?

    Close this. My IPod now works. Yes, if you must know, it was something stupid that I had overlooked. I still wonder what that "double horse shoe" symbol means, though. It wasn't pointing to my stupid mistake, that I do know

  • Airpot extreme 4th gen, internet connection works and doesn't work

    I have this airport extreme 4th generation that worked just perfectly untill 2 days ago.
    I have a modem from the Tel Company. From there a RJ45 cable goes into the Airposrt extreme.
    The light is green.
    If I open the airport utility, it tells me the internet connection works (green light) and sometimes doesn't works (orange light)
    I first had problem with wifi on iPhone 4s (wife and friends), who couldn't join the wifi network anymore. They can see the wifi network, they type the password but can't login.
    I had problems with my last gen MacBookPro, apparently for no reason. Sometimes it connects some other time it doesn't.
    Same story with my iPhone5.
    I also made an hard reset of the airport extreme but with no result. nothing changed.
    Sometimes the internet connection is on some other times is off.
    Now I want to understand where is the problem, can be the ISP, can be the airport that is damaged?
    Thanks.

    Router mode: Bridge mode
    You do not have multiple public IP.. DHCP is the wrong setting..
    One or the other has to be bridged.. the AE is currently the one bridged..
    Or the modem has to be bridged.. pick on or the other.
    Did you chack the modem logs?
    What modem is it?
    What do the lights on the modem show when the connection drops out?
    Did you plug something directly into the modem and see if internet is still working when the AE stops working??

  • Microphone on iPad 3 stopped working.reset doesn't work

    HEllo,
    Can anyone help me in regards to the microphone on ipad3? It was working fine yesterday but today it doesn't work. I tried resetting by holding the home and power button, restored original settings and nothing. Anyone had this problem? What do I do?

    I saw one post where a user said dust got inside the small microphone hole. Using a vacuum cleaner removed the dust and restored the audio.
     Cheers, Tom

Maybe you are looking for

  • Tablet Zip the file through the algorithm

    My requirment is that I am to zip the file in xi and send to receiver using Soap Adapter. From Receiver again response will go to sender via XI. At the sender side again I want zipped file. Is it possible... Do i need to unzip the file at receiver en

  • Problems with finder and mail. Lion no mountain lion. Sorry HELP!

    I came through here as cannot open in Lion. When down loaded up dates, had many problems in lion 10.7.5    when up loading photos and the drop down menure in finder opens, To chose file , When clicking on file another opens, When exporting same probl

  • 120Hz

    *I am considering getting a 120HZ HDLCD my understanding is when running at this rate the system adds frames to compensate for speed variance, I am considering getting fcp and my questions are; If I make or add frames of my choice to lesser fps video

  • Need some func specs for practice...

    Hi guys, If its possible, I would like to get some func specs/requirements so I can practice. Anyway, here is my e-mail: [email protected] Again, thank you guys and have a nice day!

  • What does searchable items in search admin page mean?

    whatdoes searchable items in search admin page mean? I guess it is total indexed items. How we can get the same data using c# API When i reset my index,  searchable items becomes 0. How to get this value Rajesh