Wait cursor not working with short cut keys

Hi,
I have JButton in my application for which i have set the short cut key using
button.setMnemonic(char)
method of JButton. Also i have set the wait cursor for the same button using
button.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)) .
I am getting the wait cursor if i click on the button,but not when i use the shortcut key.
Why is it like that? Pls help me out.

Why don't you use this class :
import java.awt.*;
import java.awt.event.*;
import javax.swing.SwingUtilities;
public class WaitCursorEventQueue extends EventQueue {
public WaitCursorEventQueue(int delay) {
this.delay = delay;
waitTimer = new WaitCursorTimer();
waitTimer.setDaemon(true);
waitTimer.start();
protected void dispatchEvent(AWTEvent event) {
waitTimer.startTimer(event.getSource());
try {
super.dispatchEvent(event);
finally {
waitTimer.stopTimer();
private int delay;
private WaitCursorTimer waitTimer;
private class WaitCursorTimer extends Thread {
synchronized void startTimer(Object source) {
this.source = source;
notify();
synchronized void stopTimer() {
if (parent == null)
interrupt();
else {
parent.setCursor(null);
parent = null;
public synchronized void run() {
while (true) {
try {
//wait for notification from startTimer()
wait();
//wait for event processing to reach the threshold, or
//interruption from stopTimer()
wait(delay);
if (source instanceof Component)
parent = SwingUtilities.getRoot((Component)source);
else if (source instanceof MenuComponent) {
MenuContainer mParent =
((MenuComponent)source).getParent();
if (mParent instanceof Component)
parent = SwingUtilities.getRoot(
(Component)mParent);
if (parent != null && parent.isShowing())
parent.setCursor(
Cursor.getPredefinedCursor(
Cursor.WAIT_CURSOR));
catch (InterruptedException ie) { }
private Object source;
private Component parent;
and then add to your application :
//Wait cursor
EventQueue waitQueue = new WaitCursorEventQueue(200);
Toolkit.getDefaultToolkit().getSystemEventQueue().push(waitQueue);
The number (200) specifies the milliseconds to activate the WaitCursor.
It will work anytime your app is busy for more than that time.

Similar Messages

  • Soundtrack will not work with Final Cut Express 4.0.1

    Just spoke to the tech guy, he was explicit in saying that Apple has discontinued Soundtrack for FCE. It will never be added, final, that's it. Options given 1) Buy another software that works or 2) Use Garageband. No point in complaining any more as they will just log your complaint and that's it. This will never been fixed by them was what he said.

    Your comments are perfectly fine but Apple should never have called FCE 4.0 an upgrade as it clearly stats on the box "Upgrade Requires any previous version". I am sorry but Apple is not above laws for consumers in other countries. This upgrade is linked to previous FCE applications and therefore should have included all previous components purchased whether they included an upgrade or not. I do not have the extra money to be buying more software that is why I bought the upgrade and not FCS. Soundtrack was bundled with FCE 3.5 on the same disk. Live Type was also bundled in that package as well. They do have the right to alter their products, but they don't have the right to promote the upgrade to users with older versions without explaining clearly in their advertising of the product that a vital part is no longer available. Might seem like a small issue to you, but Apple software costs a lot more here than it does where you live.

  • I m in from bangladesh 7days ago I bought an iphone 4 but not work with sim card. no service.

    7days ago I bought an iphone4 from my friend Mithu who come from Singapore.
    He told me he that after 7days he come dhaka and open my iphone by using sim. but 4days ago he died on road accident.
    He didn't give me any documents & I also knocking his family for that but said they didn't know about iphone. but i cut a sim & insert it in my iphone but showing no service, some time no sim.
    How can I work with my iphone,
    plz plz plz advise me. I hv not enough money to buy another one,
    Plz help me remembering steve jobs.
    Version------- 4.2.1(8C148).
    Carrier Lab 9.0
    Model MC603B.
    Serial---8602613MA4S

    The iPhone 4 may not work with a cut down SIM. Get a microSIM from your carrier when you set up service.

  • Product key will not work with this edition of Windows 7

    I received a product key for Windows 7 Professional N whilst I was at University via Dreamspark. I'm building a new computer and when it's come to inputting the product key, it comes up saying Product key will not work with this edition of Windows 7.
    The version I installed was Windows 7 Professional using an iso and a USB. I rang the phone activation number and when I got through to a representative, I gave him the product key and he said it is valid and should be working. He transferred me to technical
    services but instead I got cut off.
    At this point I'm really not sure what the issue is, the key was for Windows 7 Professional N, I installed Windows 7 Professional and customer support confirmed it as a valid key. Am I missing something?

    Post your issue to the Windows 7 Genuine Issues forum.  Here are the instructions on how to produce a diagnostic:
    MGA
    Diagnostic Report:
    To properly analyze and solve problems with Activation and Validation, we need to see a full copy of the diagnostic report produced by the MGADiag tool (download and save to desktop -http://go.microsoft.com/fwlink/?linkid=52012 )
    Once downloaded, run the tool.
    Click on the Continue button, after a short time, the Continue button will change to a Copy button.
    Click on the Copy button in the tool (ignore any error messages at this point), and then paste (using either r-click/Paste, or Ctrl+V ) into your post.
    One
    Issue Per Thread:
    Most Activation and Validation issues look the same, on the surface, but can have many different causes and fixes. This is why we ask for a diagnostic report and this is also why we ask that you create your own thread for your issue (in other words,
    don't post your issue in another person's thread). 
    It just becomes too complicated to try to troubleshoot multiple different issues in the same thread.
    New
    to the Forums?
    Instructions
    by  Kamin of Ressik 
    Wanikiya and Dyami--Team Zigzag

  • Cc2014 premiere short cut key not function in Window 7?

    Hello All
    Just got my premiere CC 2014 update recently somehow all the Hotkey or short cut key is not function like "space bar C or V )
    the keyboard works fine "i can type"wonder if anyone have the same problem or know how to solve this problem
    thank you   
    Kelvin
    and I test with other adobe product photoshop bridge works fine, in the premiere interface i go under edit/ keyborad shortcuts on the selection tool razor tools slip tool etc none of them had the shortcut mark on the side
    I try to click and create a shortcut to it but unable to, what is going on I had a few project due very soon. please help

    I'm the only person that needs to save the Titles?
    I do it sometimes when I want to reuse a title in more than one project.
    When you export out the Titles, what happens then?
    Only then does it become a separate file, suitable for importing into other projects.  This is NOT necessary to export your finished video,  it's only necessary if you want to reuse the title in other projects.
    The Titles are photos and scrolling words, that are used together as a memoriam in different projects. So having the Titles as separate files on the HD is pretty much essential.
    That's more than just a title, which in PP usually contains only text.  For something this complex, it might be better to create a base project or template that contains all the elements you want to reuse, and then start new projects with that, renaming to a new project name immediately after opening the template.
    For example, I have an HD Wedding project that contains all my sequences, graphics and titles ready to go in organized bins.  I start by opening that project and do a Save As... using the couple's last name.  That way each new project starts with the elements I need and I don't have to recreate them all the time.

  • Modifer keys do not work with mouse in Illustrator

    Below is a copy of a bug report I just submitted to Adobe. I don't suppose any users have run across this and found a solution or workaround?
    I found someone else with this problem in an archived topic thread, but the only response that poor fellow got was an accusation of not following instructions (His problem wasn't user error, BTW).
    Thanks
    ******BUG******
    Concise problem statement:
    Modifer keys do not work with mouse: For example, free transform or rotate behaviors that require "Click-Ctrl" .
    Steps to reproduce bug:
    1. select object
    2. select free transform tool
    3. left click (without releasing) a corner of the bounding box.
    4. start dragging
    5. press ctrl
    Results:
    object behaves as though the ctrl key was not pressed. i.e. the cursor does not change shape and the object scales rather than distorts.
    Expected results: The cursor should change shape as the ctrl key is pressed and the object should distort rather than scale.
    Additional information: This behavior is intermittent. Occasionally Illustrator recognizes the "Click-Ctrl" combination and behaves exactly as the help file predicts it will. The cursor changes shape and the object distorts rather than scales. I can offer no rhyme or reason for when Illustrator will behave as advertised and when it will ignore the modifier keys.
    The example above involves the free transform tool, but the problem occurs just as often with other tool behaviors that require a modifier key + mouse combination.
    Primarily using Wacom Intuos3 tablet. (with latest drivers), but have also tried combinations with microsoft mouse or both mice installed.
    Also, immediately after an occurrence Illustrator bug, left AI open, went to a different app that uses mouse+modifier (Ctrl+Click). That different app recognizes Ctrl+Click with no problems whatsoever.

    Thanks Guys,
    Good to know it's working for you. I guess that's the nature of intermittent bugs. Of course, Adobe's bug report form has a field for version, which I, of course, filled in. Sorry I didn't add it to this post. I'm using the latest version CS3 v13.0.2.
    Stephen,
    Sorry I was not more clear when I said, "For example, ...". I was talking about the modifier keys not working with several different tools. The Free Transform tool advertises functionality that is supposed to work with a "Click (down, but don't release)then hold down Ctrl" combination. The Rotate tool advertises a behavior that is supposed to work with an "Alt-Click" combination. These are just 2 examples of the modifier keys not working. I focused primarily on one example in the bug report(ctrl after and in addition to click in the free transform tool, not alt-click in the rotate tool).
    Here is what I expect(quoted from Adobe's CS3 help file)
    (From the "Distort Objects with the Free transform tool" help topic)
    "Select one or more objects.
    Select the Free Transform tool .
    Start dragging a corner handle on the bounding box (not a side handle), and then do one of the following:
    Hold down Ctrl (Windows) or Command (Mac OS) until the selection is at the desired level of distortion.
    Hold down Shift+Alt+Ctrl (Windows) or Shift+Option+Command (Mac OS) to distort in perspective."
    (from the "Rotate an object by a specific angle" help topic:)
    You can control the exact angle of rotation with the Rotate command.
    Select one or more objects.
    "Do one of the following:
    To rotate around the center point, choose Object > Transform > Rotate, or double-click the Rotate tool.
    To rotate around a different reference point, select the Rotate tool. Then Alt‑click (Windows) or Option‑click (Mac OS) where you want the reference point to be in the document window.
    Enter the rotation angle in the Angle text box...."
    These Tool based mouse-key combinations do occasionally work as they are supposed to, so I know what the expected results are supposed to look like, but whether they work or not appears to depend on the phase of the moon, the day of the week, and the color of the president's underwear.
    Other non-tool based mouse-key combinations in Illustrator work consistently all the time - Ctrl-A for Select All as just one example that always works.
    Thanks Again

  • Brand new 15" MacBook Pro Retina - unplugged from Thunderbolt Display and Keyboards today find keyboard alpha-numerics not working; except the function keys, delete key, tab key, command/ctrl/shift/alt/fn and arrow keys; and 7/8/9/u/o/j/l nudge cursor

    Brand new 15" MacBook Pro Retina - unplugged from Thunderbolt Display and Keyboards today find keyboard alpha-numerics not working; except the function keys, delete key, tab key, command/ctrl/shift/alt/fn and arrow keys; and 7/8/9/u/o/j/l produce cursor nudges.

    It's a new machine - and the Thunderbolt Display is meant to work with it. You need to just make an appointment at your local Apple Store and have them fix whatever is wrong.
    If you like, you could always try a SMC reset and a PRAM/NVRAM reset to see if either of those will get your keyboard back in working order...
    Clinton

  • TS1297 My numbers / symbols 1-9 / !-(  do not work on my wireless key pad.  I have tried the resolution information but, still no response with those keys only.  I can only type these keys with the keyboard viewer.  Any suggestions?

    My numbers & symbols 1-9 / !-(  do not work on my wireless key pad.  I have tried the resolution information but, still no response with those keys only.  I can type these keys with the keyboard viewer, thankfully.  Any suggestions?

    Unable to type while Mouse Keys is enabled in OS X

  • The volume keys on my Logitech K760 wireless keyboard do not work with my 2.3 GHz, Intel Core i5 Mac mini which runs Mac OS X 10.7.4. Anyone know how to correct this without having to re-code firmware?

    My first post to the Apple Support Community so it looks like all I wanted to know is covered in the title. The research I have done led me to solutions that I am not comfortable trying for fear of irreparably damaging my keyboard and/or Mac mini. Does anyone have a simpler solution? Please? Hellooooo?
    Just in case the title is too long to show, I have re-pasted here:
    The volume keys on my Logitech K760 wireless keyboard do not work with my 2.3 GHz, Intel Core i5 Mac mini which runs Mac OS X 10.7.4. Anyone know how to correct this without having to re-code firmware?

    BDAqua wrote:
    Hello & welcome to the Forums!
    I think Spark cured this for another person and the same problem...
    http://www.shadowlab.org/Software/spark.php
    http://scripts.sil.org/cms/scripts/page.php?site_id=nrsi&id=ukelele
    http://doublecommand.sourceforge.net/
    Thank you for the response. Unfortunately, I could not figure out how to work the above applications. I thought that i had managed to assign the appropriate function keys in Spark to their volume counterparts, but it had no effect. Below is a screen shot. Do you see anything amiss?

  • Brightness and volume control keys not working with windows 7?

    brightness, volume control and some other keys keys are not working with windows 7 with macbook pro retina. Can I fix it?

    Welcome to the Apple Support Communities
    Have you installed Boot Camp drivers? You need them to make your computer work properly on Windows, and to use your function keys as Play or Pause, volume and brightness keys.
    To install them, follow these steps:
    1. Press the X key while your Mac is starting to start into OS X.
    2. Open Boot Camp Assistant and tick only the option to download Windows support software.
    3. Windows support software will be downloaded and Boot Camp Assistant will ask you to burn it into a DVD or USB drive, so do it.
    4. Start into Windows, insert the DVD or USB drive and install Boot Camp drivers. Your Mac and your volume and brightness keys will be working after installing the drivers

  • Hp t510 right alt key mapping not working with ctrl + s

    Using the HP t510 to launch a xendesktop session via storefront. We have a mission critical application that uses the ctrl + alt + s hotkey to secure itself. The left alt key with ctrl + s is working as it should but the right alt key does not. When testing in the win7 on screen keyboard the right alt and ctrl stay lit up. When hitting the S key after depressing both the  right alt + ctrl (right or left ctrl doesn't matter) the alt keys disappear from the on screen keyboard as if they were no longer pushed. They hotkey combination never makes it to the application and it does not secure itself.
    I've tested this same workflow on an ASUS thin client, desktop, and laptop hardware with no issues. It does in fact seem to be some hotkey mapping the HP device has baked into it using the right alt key.
    Has anyone seen any issues that even closely mimic this? I've seen some for ctrl + alt + del but their fixes don't work for this specific issue.

    Hello xXenStatex,
    Welcome to the HP Forums, I hope you enjoy your experience! To help you get the most out of the HP Forums I would like to direct your attention to the HP Forums Guide First Time Here? Learn How to Post and More.
    I understand that the alt key mapping is not working with ctrl + s on your Thin Client, and I would be happy to guide you towards a resolution!
    I am sorry, but to get your issue more exposure, I would suggest posting it in the commercial forums, since this is a commercial product. You can do this at:
    http://h30499.www3.hp.com/t5/Workstations-Thin-Clients/bd-p/bsc-635
    I hope this helps!
    Regards
    MechPilot
    I work on behalf of HP
    Please click “Accept as Solution ” if you feel my post solved your issue, it will help others find the solution.
    Click the “Kudos, Thumbs Up" on the right to say “Thanks” for helping!

  • Right shift key not working with middle row of letters

    The right shift key on my Macbook Pro does not work with the middle row of letters. It works with all other letters and numbers, just not A-L. Nothing out of the ordinary happened, it just stopped capitalizing

    Try resetting your SMC and PRAM.
    Resetting the System Management Controller >>
    If that does not work, test it using an external keyboard.
    Dave M.
    MacOSG Founder/Ambassador  An Apple User Group  iTunes: MacOSG Podcast
    Macsimum News Associate Editor  Creator of 'Mac611 - Mobile Mac Support'

  • Using shift key not working with bluetooth keyboard

    Am I missing something here? Or does the shift key not work with the iphone using a bluetooth keyboard?  I'm using the logitech K810 for reference on iphone 6 iOS 8.1

    The shift key works just fine on my Bluetooth keyboard.  So I would imagine this is an issue with your keyboard.

  • F2 key does not work with excel

    Dear Friends,
    when i am working with excel, f2 key does not work as its shortcut. can you please help me how i can solve this. thanks a lot

    what if you press Fn + F2? Does anything pop up?
    Regards,
    Jin Li
    May this year, be the year of 'DO'!
    I am a volunteer, and not a paid staff of Lenovo or Microsoft

  • Why the iPad internal speakers not working with some applications and key sound?

    My iPad1 ' internal speakers not fully functioning. It is working with music and video, YouTube , but not working with applications such as games.
    Also with key pad sound .
    Please help me in this regard.

    If you lose sounds for keyboard clicks, games or other apps, email notifications and other notifications, system sounds may have been muted.
    System sounds can be muted and controlled two different ways. The screen lock rotation can be controlled in the same manner as well.
    Settings>General>Use Side Switch to: Mute System sounds. If this option is selected, the switch on the side of the iPad above the volume rocker will mute system sounds.
    If you choose Lock Screen Rotation, then the switch locks the screen. If the screen is locked, you will see a lock icon in the upper right corner next to the battery indicator gauge.
    If you have the side switch set to lock screen rotation then the system sound control is in the task bar. Double tap the home button and in the task bar at the bottom, swipe all the way to the right. The speaker icon is all the way to the left. Tap on it and system sounds will return.
    If you have the side switch set to mute system sounds, then the screen lock rotation can be accessed via the task bar in the same manner as described above.
    This support article from Apple explains how the side switch works.
    http://support.apple.com/kb/HT4085

Maybe you are looking for

  • How to best minimize a loud crow over an outdoor interview?

    What is the best tool to use in Soundtrack Pro that would minimize the repetitive sound of a loud crow that can be heard in the background of an outdoor interview? Do you use the Spectrum Analyzer followed by another tool? I realize it may not be pos

  • Anyone using itunes with XP MEDIA CENTER?

    I have had trouble installing itunes for DAYS! I kept getting the is not a win 32 app...did the troubleshooting but cant get the itunes uninstalled because it never got installed and cant find where to remove the set up. When I try to delete the TEMP

  • Phone stuck in Recovery mode, nothing will work!

    I recently lost my phone, so I used the find my Iphone app on icloud. I had locked my phone from there. Once I found my phone I unlocked it with my password then it immediatly went to the recovery screen where it tells you to plug into itunes. I thou

  • IS THERE ANY SIMPLE WAY TO RETURN SPEED PERFORMANCE TO FACTORY SPEED AFTER ABOUT 3 YEARS OF RELATIVELY STANDARD USE?

    Everyone is often so quick to bash all these 'cleaning' utilities but rarely give any solutions. There's a lot of critiques and endless lists of what NOT to do to avoid performance problems. My Powerbook is 3 years old. It runs like molasses... SLOW.

  • How to print the InputStream

    I got InputStream from the HttpServlet.post() Now i want print it to console Please help me how to print this. code Snippet class Listner extends HttpServlet public void doPost( HttpServletRequest req, HttpServletResponse res ) InputStream _inputStre