Making JButton not respond when hour glass cursor

Hi,
I know how to change the cursor to the hour glass one but what I want is that JButtons will not responds to clicks from an hour glass cursor. The JButtons should only respond to clicks from the normal cursor.
Does anyone know how to do this?
Thanks,
Jim

Below is a solution for JDK 1.4 without threading.
In the event handler of ActionLock the following happens:
1. disable the button.
2. repaint the button using paintImmediately().
3. perform the search.
4. post an "enable button" event on the event dispatching queue using invokeLater().
5. handle possible clicks during the search. They are ignored since the button is disabled.
6. the "enable button" event is handled on the event dispatching thread.
Three comments:
i) if step 2 is not done the paint event triggered by disabling the button will not be handled until just before step 6. Visually the button will thus not appear disable.
ii) if step 4 is not done through invokeLater step 6 is done before step 5, thus the clicks will start new searches.
iii) focus issues are solved by making the button not focusable.
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class ButtonTest
  public static void main(String[] args)
    JFrame frame = new JFrame("Button test");
    frame.getContentPane().add(new MButton(new SearchAction()));
    frame.pack();
    frame.show();
class SearchAction extends AbstractAction
  public SearchAction()
    super("Search");
  public void actionPerformed(ActionEvent e)
    try
      Thread.currentThread().sleep(3000);  // Simulate time-consuming search
    catch (InterruptedException ex)
class ActionLock implements ActionListener
  private ActionListener m_OriginalListener;
  private JButton m_button;
  public ActionLock(ActionListener listener, JButton button)
    m_OriginalListener = listener;
    m_button = button;
  public void actionPerformed(final ActionEvent e)
    m_button.setEnabled(false);
    m_button.paintImmediately(
        0, 0, m_button.getWidth(), m_button.getHeight());
    m_OriginalListener.actionPerformed(e);
    SwingUtilities.invokeLater(new Runnable()
      public void run()
        m_button.setEnabled(true);
class MButton extends JButton
  public MButton(Action action)
    super(action);
    setFocusable(false);
  public void addActionListener(ActionListener listener)
    super.addActionListener(new ActionLock(listener, this));

Similar Messages

  • I am having autocad not respond when I am making a pdf using autocad 2002 and adobe acrobat XI

    I am having autocad not respond when I am making a pdf using autocad 2002 and adobe acrobat XI
    We have adobe acrobat 8 on another system that seems to work fine,  what elsedo we need to do to get this trial version to work properly.
    We are able to get everything set up , sized, etc,  but when the actual process starts it is stating  "autocad not responding and it  just spins and never makes the actual final pdf.
    Any help on this would be appreciated

    It's probably a compatibility problem with the updated PDF libraries vs. you hopelessly old ACAD that can't be resolved. In any case, I'd consider it one of those things of trying to attack the problem on the wrong end. All major CAD programs have native PDF export these days and even ACAD has had since v2006 at least...
    Mylenium

  • My ipod touch is not responding when i plugged it  in even with a different cord and restarting my computer

    my ipod touch is not responding when i plugged it  in even with a different cord and restarting my computer and i am using my moms itunes that she has had for a long time and so i cant uninstall itunes.

    Try:
    - iOS: Not responding or does not turn on
    - Also try DFU mode after try recovery mode
    How to put iPod touch / iPhone into DFU mode « Karthik's scribblings
    - If not successful and you can't fully turn the iOS device fully off, let the battery fully drain. After charging for an least an hour try the above again.
    - Try on another computer
    - If still not successful that usually indicates a hardware problem and an appointment at the Genius Bar of an Apple store is in order.
    Apple Retail Store - Genius Bar       

  • With ios 8.3 ipad mini apps sometimes do not respond when touched

    a new problem occurred with ios 8.3 ipad mini applications sometimes do not respond when touched Fix it in ios 8.4

    If it has NEVER been jailbroke, here are some standard repair procedures:
    First, try a system reset.  It cures many ills and it's quick, easy and harmless...
    Hold down the on/off switch and the Home button simultaneously until you see the Apple logo.  Ignore the "Slide to power off" text if it appears.  You will not lose any apps, data, music, movies, settings, etc.
    If the Reset doesn't work, try a Restore.  Note that it's nowhere near as quick as a Reset.  It could take well over an hour!  Connect via cable to the computer that you use for sync.  From iTunes, select the iPad/iPod and then select the Summary tab.  Follow the on-screen directions for Restore and be sure to say "yes" to the backup.  You will be warned that all data (apps, music, movies, etc.) will be erased but, as the Restore finishes, you will be asked if you wish the contents of the backup to be copied to the iPad/iPod.  Again, say "yes."
    At the end of the basic Restore, you will be asked if you wish to sync the iPad/iPod.  As before, say "yes."  Note that that sync selection will disappear and the Restore will end if you do not respond within a reasonable time.  If that happens, only the apps that are part of the IOS will appear on your device.  Corrective action is simple -  choose manual "Sync" from the bottom right of iTunes.
    If you're unable to do the Restore (or it doesn't help), go into Recovery Mode per the instructions here.  You WILL lose all of your data (game scores, etc,) but, for the most part, you can redownload apps and music without being charged again.  Also, read this.

  • My touch just stopped playing as if out of power, but is not responding when plugged in

    My iPod touch just stopped playing as if out of power, but it is not responding when plugged in.  I've left it plugged in for about an hour and still nothing. I'm not sure how to reset. Any suggestions would be welcomed....

    Try here. If not successful, an appointment at the Genius Bar of anApple store is in order.
    iPod touch: Hardware troubleshooting

  • I am suddenly unable to open mail from the dock. dock shows mail is up and running, but stamp does not respond when clicked, and will not quit. help?

    I am suddenly unable to open mail from the dock. dock shows mail is up and running, but stamp icon does not respond when clicked, there is no mail window opened, and will not quit. when double clicked, get new mail is not an option and I get no response with other actions.
    I am retrieving mail on my phone with no problem. this just began happening, no updates or problems with anything else.
    help?

    command-option-esc keys and force quit Mail. Then relaunch.

  • Itunes keeps not responding when i try to log out of my account

    itunes keeps not responding when i try to log out of my account
    I have tried uninstalling the itunes program and re Installing it but it has not worked,
    Is there anyone that can help me?

    Have you tried leaving it to hang for 5 minutes?

  • The pass 4 days now my iTunes Store is not responding, when I reload it all that comes up is a blank white page that says iTunes Store. Help please!!!! Cannot load my gift card to buy music and such!!!

    The pass 4 days now my iTunes Store is not responding, when I reload it all that comes up is a blank white page that says iTunes Store. Help please!!!! Cannot load my gift card to buy music and such!!!

    I tookyour suggestion and SUCCESS!  I can now access the Itunes Store.  A simple fix, and thanks so much!!.
    Below is the advice you forwarded:
    I found a solution to my problem.
    > start menu
    > accessories,
    > right click on the command prompt icon and choose "run as administrator".
    Once it opens, type in the following command...
    netsh winsock reset
    hit enter
    You should get a message that the winsock reset successful and you will need to reboot your computer.
    Reboot and when I reloaded itunes the store loaded fine.
    Thanks again, -Dean Stoneburner

  • The volume up and down controls on my wireless keyboard show a no entry sign and do not respond when used...please help?

    The volume up and down controls on my wireless keyboard show a no entry sign and do not respond when used...please help?

    If you want to get a little more "exotic" you can try remapping the function keys.  I did a little google searching and the hits that looked promising are,
    Mapping volume and eject keys to 3rd-party keyboard Other Hardware
    Spark
    Spark is a powerful, and easy Shortcuts manager. With Spark you can create Hot Keys to launch applications and documents, execute AppleScript, control iTunes, and more...
    You can also export and import your Hot Keys library, or save it in HTML format to print it.
    Spark is free, so use it without moderation!

  • Access 2010 on 64 Bit Windows 7 Access "Not Responding" when changing from forms view to design view and back

    I am running
    Windows 7 64 bit
    Access 2010 32 bit
    Developing an application with a split FE BE with both files local but continue to have the message "Not Responding" when switching from forms view to design view and back as well as if I try to connect to a subform or object on the sub form.

    I have seen this behavior when the form's RecordSource is a complex query such as a crosstab or a query with several nested queries. To test if this is your case, remove the RecordSource and see if the form starts acting normal again.
    Then again, if the form has several subforms they might be slowing up the loading time.
    Bill Mosca
    www.thatlldoit.com
    http://tech.groups.yahoo.com/group/MS_Access_Professionals

  • Lion Clients 10.7.4 show network accounts are unavailable and server is not responding when binding to Snow Leopard server 10.6.8

    Hello,
    I am running Snow Leopard Server 10.6.8 and my clients are Lion 10.7.4.  While testing I had no issues binding 10.7.4 to our 10.6.8 server's OD.  I created a 10.7.4 image to push to all of our machines and in the beginning of last week I was able to push the image and get the machines to bind with OD and apply preferences on these machines through workgroup manager.  Towards the end of the week though this stopped working.  Now any time I bind a 10.7.4 client to OD it allows me to perform an authenticated bind and the machine shows up in workgroup manager but immediatley after binding the client the status jelly next to the OD server in the directory list is red and says "This server is not responding".  If I reboot the client I get a notification that "Network accounts are unavailable" at the login screen.  My preferences from workgroup manager are also not applying, which is my main concern because without workgroup manager my mac server is somewhat pointless as we use it for very little else. 
    I've since tried to bind a snow leopard machine (10.6.8) and this still is working with a green status jelly.  I've also built a lion machine from scratch, updated to the 10.7.4 combined update and am still getting the same issue where it shows the server is not responding when binding to OD.  I then applied the subsiquent OS update after the 10.7.4 combined update but the problem still persists.
    Is anyone else having this issue?  Any help would help me keep my sanity.
    Thanks,
    Dane

    Have you had any luck finding a solution to this?  The only thing I have found was to unbind and then bind without authentication.  Any help with progress on your end would be appreciated!
    Nick.

  • Photoshop CS6 is not responding when leaving PS and coming back again

    A weired problem: My new installation of Photoshop CS6 (OS X Mavericks on a new MBP) is not responding when leaving PS and coming back again.
    Example: i open a new file in PS - then i click on the desktop - when i go back to PS again, it is not responding to any click on any window (except for the menu bar).
    I can solve the problem when i try going back several times or when i go back to PS via the icon in the dock.
    But it is still very annoying in a quick workflow.
    I would appreciate any idea what i can check more, cause i tried everything and i can’t find this issue on the web…
    Thanks…

    Problem solved… The troublemaker was the Trackball Works Driver for Kensington trackballs / Expert Mouses…
    I’m now using a generic driver for USB devices and everything is fine.

  • My computer had to be shut down this morning when I could move my mouse around but it would not respond when I double clicked on an item to select.  Now I cannot open a file in my finder window by double clicking on it.  Any suggestions?

    My computer had to be shut down this morning when I could move my mouse around but it would not respond when I double clicked on an item to select.  Now I cannot open a file in my finder window by double clicking on it.  Any suggestions?

    Did you reinstall CS3 after CC?
    For that matter, doing an in-place upgrade on the OS is always a gamble with Adobe programs. Reinstalling all the versions you need, in order, would probably solve your problem.
    And you shouldn't need to save as IDML after opening the .inx in CC.

  • HT4097 my ipad not responding when i connected to pc

    my ipad2 not responding when i connected to pc, like no device connection to cpu

    Do you mean evil your device is not recognised in iTunes for Windows? If so,
    Firstly, make sure that your device is not hidden (left hand pane). If it just reads device then toggle between SHOW and HIDE.
    Secondly, try all the other ports on your computer, even a number of times.
    Thirdly, if you have another computer try plugging your device into it without taking any action, give it a moment, remove it and try it back in your other computer again.
    Failing all that, see here - http://support.apple.com/kb/TS1538
    And failing all that put the device into Recovery mode. See here and note the paragraph 'If you restore from a different computer.... ' down near the bottom of the page -
    http://www.apple.com/support/ipad/assistant/itunes/

  • V8.2 "Not Responding" when updating XY Graph Prpoerties

    LabVIEW 8.2 running on Windows XP crashes (slows to mouse clicks then gets reported as "Not Responding") when I try to format the plot properties (color, weight, etc) on a multi-plot XY Graph.

    ST1,
    Could you provide us with some more details so that we can better help you?
    How much data must be graphed to cause the slowdown (both data-points and plots)?
    Does this happen with any multi-plot XY chart or just in one VI?
    Is your XY chart inside a tab control or similar structure?
    Is your computer running low on memory when this happens?
    Regards,
    Simon H
    Applications Engineer
    National Instruments

Maybe you are looking for

  • Do I have to downgrade Bootcamp 5.1 to 4.0 to install windows 7 32 bit?

    I have an early 2010 MacBook Pro running Windows XP on my bootcamp partition.  I recently upgraded the Mac side to Mavericks and thus have Bootcamp 5.1 installed.  The documentation I've been reading says that 5.1 only supports the 64 bit version of

  • Picklist web Service Custom Object

    I am using the Picklist web Services and am trying to use them against a custom Object. They work fine for standard objects such as account but are failing against my custom object. I have tried calling it "Custom Object 01", "CustomObject1","connect

  • New iPhone 4 keeps crashing my iTunes- any suggestions as to why?

    I've registered my new iphone 4 with iTunes on my Mac- all fine, Apps, Contacts, iCal and so on. The music library is too large to fit so I've hit 'Automatically fill free space with songs". Now every time I plug in it Syncs but whenever I try to do

  • "The movie could not be sent to QuickTime"

    I am unable to export from iMovie as a QuickTime movie because when I attempt to "Share" an iMovie project as a QuickTime movie, at the very end of the data compression process, the export is cancelled and this message appears: "The movie could not b

  • My curve 8900 screen keep going white

    in need of some help my curve screen keeps going white after turning it on sum time it come on ok for about 10mins then it locksup and go white again will try any thing to sort it