How can I disable any mouse event while is another is processing?

Hi!
I've a problem and I need some help.
I'm downloading an image in the MouseAdapter's mouseClicked method. So I need to disable any other mouse events produced durring this download. These events can be removed from the queue or is there is any way to disable entering mouse events to the queue while another one is processing?
If anyone can halp me, thanks a lot.

Interesting situation. I would suggest that the downloading be done on another thread; long processes shouldn't be handled on the swing thread in most situations. Then to stop the mouse events you'd simply disable the component that has the mouse listener until the image has finished loading. That way these events will be processed and discarded while the image is loading.
ie,
public void mouseClicked(MouseEvent e)
  final Component source =  (Component)e.getSource;
  source.setEnabled(false); //stop further mouse events.
  new Thread()
      public void run()
         loadImage(); //should not return until image is loaded
         source.setEnabled(true);
}Hope that helps. :)

Similar Messages

  • How can I disable the mouse button 4 and 5 "forward" and "back" functions through firefox?

    I've seen this problem come up on forums before but was unable to find a good solution.
    When using Ventrilo, I have my speak button bound to the mouse button 4 of my logitech mouse. This button is conveniently placed for gaming because it makes use of my otherwise unused right thumb, and I have been using it for years and probably couldn't adjust if i tried to change it.
    Firefox uses mouse button 4 for the "back" function, meaning that if i'm on ventrilo while browsing the web with firefox, i have to remember to move the cursor to the menu bar at the bottom of my screen or go back a page. it's infuriating if i forgot, especially if i'm playing some sort of browser game at the time, as i basically have to restart whatever i'm doing.
    The only solutions i've found for this involve binding mouse button 4 to some other (rarely used) key, which is an annoying solution at best, or changing some vital computer files, which I dont have the expertise to do myself and dont trust anyone else to do for me. It's an absolutely unacceptable solution anyway: why should i have to change my computer's files to disable a function which should be editable through firefox?
    does anyone know how this can be fixed? or know how we can get mozilla to put this feature into some future patch, as other people have been asking them to do for YEARS?

    This can be a highly frustrating problem. I just spent 45 minutes working on an email. Nearing the end I go to grab my mouse after typing and accidentally hit mouse 4 and lose everything. This isn't the first time I have lost work or an email. I would say the ONLY reason why there currently lacks a strong feedback against this is because the majority of people do not have mouse 4+5 buttons on their mice. Please add the option to just disable this "feature". It's just far to easy to accidentally hit these buttons accidentally and potentially lose a lot. I don't know anyone who actually uses these buttons anyways.

  • How can I disable the mouse pad? I prefer to use a mouse.

    The pad is particularly a nuisance when I try to type, perhps I catch it with my wrists, I don't know. I'd rather use a mouse.

    The 'quick and dirty' way would be to cover the trackpad with something thick enough not to pickup 'taps' or 'gestures'. A business card cut to fit tightly should be thick enough, but I use a three thicknesses of index card glued together and cut to fit tightly into the trackpad opening ''(one corner cut off so I can remove it when I do need to use the trackpad)''. I did that back in 2008 with an Acer laptop and do it now with my Asus EeePC 900 netbook; if I don't have the mouse with me ''(or the battery is dead - wireless USB mouse)'' I just remove the cardboard "plug" so I can use the trackpad.
    Beyond that, check with a Windows 7 support forum to see how to disable that "device". That really isn't a Firefox support issue.

  • How can I disable mouse shortcuts (mission control, etc) in games?

    I just installed the new Deus Ex: Human Revolution from the App Store and I'd like to use the miltiple mouse buttons my  Logitech mouse has in my game. I can set up the controls to use various buttons in the game, but I also have the same mouse buttons set up in the System Preferences to be used for mouse shortcuts. The problem is, when I try to use the game, the "All Applications" or the "Show Desktop" shortcuts kick in instead of the games setup controls.
    How can I disable the Mouse Shortcuts for the system while I'm in the game?

    Forgive me... I should have said:
    How do I permenantly disable the shortcuts only while in the game, without having to redo my System Preferences every time I start or stop my game?

  • How to deal with the mouse events when the thread is running

    Hi everybody,
    I have a problem with my program.
    Now I want to present a picture for some time in the Canvas,then automatically clear the screen, but when the user press the mousebutton or keybutton, I want to stop the thread and clear the screen.
    How can I receive the mouse event when the thread is running?
    Thanks,

    I use my code in a GUI applet.
    I try to use the code tag, it's the first time.
                   Image im=sd.getStimulus(obj);
                   if(pos==null){
                        g.drawImage(im, (w-im.getWidth(null))/2,(h-im.getHeight(null))/2,null);
                   }else{
                        g.drawImage(im, pos.x,pos.y,pos.w,pos.h,null);
                   try{
                        sleep(showtime);
    //                    Thread.sleep(showtime);
                   }catch(InterruptedException e){}
                   if(pos==null){
                        g.clearRect((w-im.getWidth(null))/2,(h-im.getHeight(null))/2,im.getWidth(null),im.getHeight(null));
                   }else{
                        g.clearRect(pos.x,pos.y, pos.w, pos.h);
                   }

  • How can i disable mouse right clicking event

    I need in my project to disallow any body to right click the mouse. Can i disable this event to prevent user of the application from right clicking if yes how can i disable it.

    I have code written in Visual Basic doing the same task but i don't know how to transfer those code in java
    The following is a code for that:
    Option Explicit
    'declares
    Public Declare Function SetWindowsHookEx Lib "user32" Alias "SetWindowsHookExA" (ByVal idHook As Long, ByVal lpfn As Long, ByVal hmod As Long, ByVal dwThreadId As Long) As Long
    Public Declare Function UnhookWindowsHookEx Lib "user32" (ByVal hHook As Long) As Long
    Public Declare Function CallNextHookEx Lib "user32" (ByVal hHook As Long, ByVal nCode As Long, ByVal wParam As Long, lParam As Any) As Long
    'constant
    Private Const WH_MOUSE_LL = 14&
    Public Const HC_ACTION = 0&
    Public Const WM_RBUTTONDOWN = &H204
    Public Const WM_RBUTTONUP = &H205
    Public Const VK_RBUTTON = &H2
    Private lMShook As Long
    Private bHookEnabled As Boolean
    'functions which process mouse events
    Public Function MouseProc(ByVal nCode As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
    If nCode = HC_ACTION Then
    If (wParam = WM_RBUTTONUP Or wParam = WM_RBUTTONDOWN) Then
    MouseProc = 1
    Exit Function
    End If
    End If
    MouseProc = CallNextHookEx(lMShook, nCode, wParam, lParam)
    End Function
    Public Function SetHook()
    If lMShook = 0 Then
    lMShook = SetWindowsHookEx(WH_MOUSE_LL, AddressOf MouseProc, App.hInstance, 0&)
    End If
    If lMShook = 0 Then
    MsgBox "failed to install hook :" & lMShook & " : " & WH_MOUSE_LL
    bHookEnabled = False
    Unload Form1
    Exit Function
    Else
    bHookEnabled = True
    End If
    End Function
    Public Function UnSetHook()
    If bHookEnabled Then
    Call UnhookWindowsHookEx(lMShook)
    lMShook = 0
    End If
    bHookEnabled = False
    End Function
    Public Function InstalledHook()
    MsgBox " installed hook is :" & lMShook
    End Function
    code for form is below:
    Option Explicit
    Private Sub Command1_Click()
    InstalledHook
    End Sub
    Private Sub Command2_Click()
    Call SetHook
    End Sub
    Private Sub Command3_Click()
    Call UnSetHook
    End Sub
    Private Sub Form_Unload(Cancel As Integer)
    Call UnSetHook
    End Sub

  • How can I disable the "Events" how can I disable "Faces"

    buona sera
    how can I disable the "Events"
    how can I disable "Faces"
    grazie

    You can not
    Events are one of many views or your photos in your library - as are faces
    YOu can simply ignore both but you can disable them
    LN

  • Hello.. I have one problem. I used automator to automaticly sync my photos to iphoto. Now I don't want it any more. How can I disable it?

    Hello.. I have one problem. I used automator to automaticly sync my photos to iphoto. Now I don't want it any more. How can I disable it?

    If you have iPhoto v9.6.1 then just launch it. Done.
    IF you don't, download it:
    Go to the App Store and check out the Purchases List. If iPhoto is there then it will be v9.6.1
    If it is there, then drag your existing iPhoto app (not the library, just the app) to the trash
    Install the App from the App Store.
    Sometimes iPhoto is not visible on the Purchases List. it may be hidden. See this article for details on how to unhide it.
    http://support.apple.com/kb/HT4928
    One question often asked: Will I lose my Photos if I reinstall?
    iPhoto the application and the iPhoto Library are two different parts of the iPhoto programme. So, reinstalling the app should not affect the Library. BUT you should always have a back up before doing this kind of work. Always.

  • How can I disable the event sound played when a new window is opened?

    When Firefox starts, or when a new window is opened there is an annoying click.
    How can I disable this?
    The only way I have been able to stop it is by disabling all event sounds from the control panel but I'd rather just disable this particular sound.

    No, it's Windows XP. Hmmm, I don't know! I only started noticing it recently and as far as I remember, the only new add on is NoScript. I found the event that was being triggered (Start Connection) and disabled the sound in Windows. So the problem is solved in that I don't have the annoying sound ... but don't know why it started and hope nothing sinister is going on.

  • How can I disable the assistive touch programmatically ? This is like a bug. Though the Guided access is enabled a user can take screenshot of my application content. How can I solve this ? any idea ....

    How can I disable the assistive touch programmatically ? This is like a bug. Though the Guided access is enabled a user can take screenshot of my application content. How can I solve this ? any idea ....

    Question: Do you think the response from the support staff is correct? I mean, surely, I can't be the only CF user on a shared box whose other users need to modify the date and time within their applications. Even if they do it at the application level for their domain, surely it wouldn't affect mine, would it? That was what was implied by the support people, but I have a feeling they are way off, or covering for some goof-up on their end. I struggled like hell yesterday trying to get this to work and I did not get very far at all.
    I found an interesting tutorial here which does a comparison of time zones and, theoretically, this might do the trick. But if what the guy told me was nonsense then I won't bother with it. For the record, our calendar has been working fine for about a week now.

  • How can I disable the annoying orange outline while I tap a link or a input area?

    i'm a user of Firefox for android. i've found a problem since I update to 16.0.2 and above. every time i tap a link or a input text in the web page, there always shows an annoying orange rectangle outline around the focused link or input area. Moreover, this outline would keep showing while I drag the page and start browsing other parts of the same page. how can I disable the annoying feature?

    This is the default feature of the browser to indicate which element are you on, if you are actually on focus with the input or tapping on the right link.
    Since this is a default feature of the browser, it now depends on the website's developer to override this feature with custom focus styles. Normally, in a browser, you can override this with user styles/scripts but as far as I know, Firefox Android does not support such features.
    However, I found [https://support.mozilla.org/en-US/questions/929362 an article] that states that there is a [https://addons.mozilla.org/en-US/firefox/addon/stylish/ plugin] that is compatible with Firefox Android that handles user styles.

  • HT204266 How can I disable my keypad on my iPad. It shows up on iBooks while I'm trying to read a book and can't get it off

    How can I disable my keypad while reading a book. It shows up and can't get it off?

    Cancel this question.  I went into my pictures and there they were. Uhhhh DUH!!!
      Gotta love iCloud!!!  Thanks guys for putting up with my silly question!  At least I gave some of you a good laugh.  Have a great day and thanks for letting me play awhile in here!!!

  • Suddenly "lost mode" enabled in my iphone. I forgot my 4 digit password. Is there any way to get out of this problem? What should i do now? How can i disable it?

    Please help!! I forgot my password and now i can't access to my iphone. How can i disable the "lost mode" and how can i fix this problem?

    You will need to restore your iPhone from the same computer that you most recently synced to.
    Read this: http://support.apple.com/kb/ht1212
    If you can't do the restore then you will need to try recovery mode.
    Read this: http://support.apple.com/kb/ht4097

  • How Can i disable folder menu in any form im ORACLE EBS?

    How  Can I disable it for user or responsibility????

    I wrote two procedures.
    DISABLE_INDEXES:
         On source:      select index_name from dba_indexes where table_name= '<%=odiRef.getTable("L","TARG_NAME","A")%> '
         On target:         alter index  #index_name unusable
    REBUILD_INDEXES
         On source:      select index_name from dba_indexes where table_name= '<%=odiRef.getTable("L","TARG_NAME","A")%> '
         On target:         alter index  #index_name rebuild
    And i used these two procedures in my package.
    Many  thanks for advices.

  • ็้้How can I disable hotkeys?

    How can I disable FF hotkeys as there are problems when I use other programs at the same time?

    Thanks a lot for the answer Shmoopie99,
    "If your plugin is running as a separate process it should not be getting any events meant for Photoshop if your plugin process is active."
    Yes that is almost correct. I dont want to get into useless details but I have no problems there and events meant for Photoshop dont disturb me.
    "If you're spinning an event loop in your Photoshop side of things, only process UI update events - ignore any other events such as input events."
    I cant ignore input events because I need them. The problem is not my tool getting input events from Photoshop, is Photoshop the one geting events comming to me.
    The only connection to Photoshop I keep in my process is that is parented to photoshop using the HWND handler.
    I must insist in the question then... How to make Photoshop wait while my window is in focus? How to disable accelerators?

Maybe you are looking for

  • Dowload open and cleared invoices to Users PC

    Hi Friends.. Can someone suggest how to download the open and cleared invoices in an excel format to users PC either in foreground or bakground based on customer account (KNA1-kunnr) and company code.. your help is greatly appreciateld and rightly re

  • Using USB device with Virtual Com port

    I have an actisys IR USB device that creates a virtual serial port. I can read from it using VISA, however it will not write. I have the same setup working on LV 6.1 running windows 2000. I need to make it work on my system running XP and LV 7.1.

  • How to pool web services in BEA 8.1

    All, I would like to have multiple instances of the web service running in the same server. Does Weblogic 8.1 do this? How? Thanks so much for your any help. Weili

  • 9800gt tv out through vga?

    Hi, i have a question for you, please someone help me! On my 9800gt 512 card, there are dvi, vga and hdmi outputs. I have big Sony crt tv, and the only conectable option is through vga to composite adapter. But, when i tried to buy it they said make

  • Receive a cluster from a dll function

    Hi, I have a function in a DLL which returns a C struct.  I want to know how can I receive a cluster from a CLFN? struct info: struct typedata{ int a; int b; const char * c; int d; int e; }data; function call: const typedata * hostinfo(int param); So