How to disable Events

I want to disable mouse events to be performed on my JFrame. How Should I do this? I used disableEvents method of Component class. But id doesn't function.
Here is the code I am using
import java.awt.*;
import javax.swing.*;
import java.awt.event.*;
public class Text extends JFrame
     Container cp;
     Text()
          cp = getContentPane();
          addMouseMotionListener(new ML());
          disableEvents(AWTEvent.MOUSE_EVENT_MASK);
          setSize(400,400);
          setVisible(true);
     class ML extends MouseMotionAdapter
          public void mouseDragged(MouseEvent me)
               System.out.println("mouse dragged");
     public static void main(String[] args)
          new Text();
In the console Mouse dragged is being printed
Is there any other way to do it.
Help needed
Thanks in advance

You can make the glasspane of the JFrame visible after adding a mouselistener to the glasspane.... of course, the mouselistener has to do nothing if you really want all mouse events completely disabled.
to apply to your example would make it something like this:
import java.awt.*;
import javax.swing.*;
import java.awt.event.*;
public class Text extends JFrame implements MouseListener,MouseMotionListener
Container cp;
Text()
cp = getContentPane();
getGlassPane().addMouseMotionListener(this);
getGlassPane().addMouseListener(this);
setSize(400,400);
setVisible(true); // sets the frame visible
getGlassPane().setVisible(true); // sets the glasspane visible.
public void mouseDragged(MouseEvent me)
System.out.println("mouse dragged");
// of course, you also need dummy implementations of other methods that MouseListener and MouseMotionListener require...
// mouseClicked(), mousePressed(), mouseReleased(), etc ....
public static void main(String[] args)
new Text();

Similar Messages

  • How to Disable Event firing while updating a list item using poweshell

    Hi All,
    I am working on a powershell code which updates most of the list items in the entire web application. I am using SystemUpdate($false) to update the items so that 'modified' and 'modified By' and versions are not changed.
    However event receivers gets fired which is now a problem. I want to disable the Event receivers before update and enable it after update. I want powershell code for this. I am using SharePoint 2010.
    Your help would be much appreciated. Thank you in anticipation.
    Regards
    Karthik R.

    hi
    check this thread:
    How to disable event firing outside an event. It contains example on C#, but it is not difficult to convert it to PowerShell.
    Blog - http://sadomovalex.blogspot.com
    Dynamic CAML queries via C# - http://camlex.codeplex.com

  • How to disable the "turn page" event triggered by the scroll/swipe function?

    The problem is as follows.
    The default behaviour of Acrobat Reader (both stand alone and browser plug-in) is to allow scrolling/swiping with the mouse wheel/trackpad. This is useful when the pdf's page length is greater than the screen's own length, because you can read the pdf with no need to distract your attention from the text to the scrollbar button. However, the same scroll/swipe function turns into a usability problem when the pdf is embedded in a html page and the pdf's page length is smaller than the browser's length. In this case, the scroll/swipe turns the page, distracting your attention from the text to the unintended behaviour of the browser. What happens is that you are so used to scrolling/swiping that you did it unintentionally in the pdf's caption area. You really did not want to turn pages in the pdf. Furthermore, if the pdf takes the whole html page, being a website, the scroll/swipe function flips the website pages in ways that neither the reader nor the writer had ever intended. Hence the question. How to disable, in this case, the "turn page" event triggered by the scroll/swipe function? A JavaScript should do, but the SDK documents did not help so far...
    Message was edited by: 41457173
    Message was edited by: 41457173

    ... or release a patch for the API,
    ... or suggest an alternative route to achieve the intended result.

  • How to disable  the mouseWheel event in Flex2?

    How to disable the mouseWheel event? Basically I want my
    flex2 app not to respond to any mouse wheel events. Thanks.

    I downloaded one of the PDF form (IMM5490) from cic.gc.ca and saved it on my computer after filling it up. Later on the following message popped up when I tried to open the form again later to in order to make some changes.
    "This document enabled extended features in Adobe Reader. The document has been changed since it was created and use of extended features is no longer available. Please contact the author for the original version of this document"
    Your help in this regard will be greatly appreciated, since, I have already filled the form with a lot of information and I will not be able to edit the form with additional information unless I disable the extended features ( I guess).

  • How to disable a Entire row in a Matrix in Find Mode (User Form)

    Hi,
    How to disable a Entire row in a Matrix in Find Mode (User Form)
    Regards
    Jambu

    Hi,
       Iam using Bubble event = false in click event but the matrix row
    is allow to edit but we cant save the document in Find Mode That is fine.
    What is my actual requirement is In find mode matrix Row not allow to enter the data .
    For examble In ADD mode i enter the data in Three rows (Item Section - Matrix) and
    save the document. Whwn i open the document in find mode the three row is not allow
    to editable like the same functionality of PO, sales Order, etc ..
    Regards
    Jambu

  • How to disable delete option or symbol in attachment control in infopath 2010

    Any have any idea how to disable the delete option or symbol near the attached file using attachment control in infopath 2010.
    I have created a custom list in sharepoint online 2013(Office 365) and customized it in  Infopath forms 2010 
    i want tht user can attach the files using attachment control but not to allow to delete other attached files.
    plzzzzzz help me out :( .

    Hello,
    As per my finding, you have to custom create event receiver to handle this situation. Use "ItemAttachmentDeleting" event to prevent user to delete attachment. Please refer below MSDN link to implement this:
    http://stackoverflow.com/questions/2023414/prevent-deletion-of-attachments-from-a-sharepoint-list-item
    Hope it could help
    Hemendra:Yesterday is just a memory,Tomorrow we may never see
    Please remember to mark the replies as answers if they help and unmark them if they provide no help

  • How to Disable message area

    Hi ,
       I have a message area and i had linked the "Enable" property of the message area to the context attribute , even if i set the Contex attribute to TRUE the message is still disabled , can some one explain me how to disable message area by linking to the context attribute.
    Regards,
    Ravi.

    HI Shriram,
               Let me explain my problem . I have two tabs in my tab strip control and each tab has its own message area , but the problem is when 2nd tab is selected and if i raise some exception is doesnt show in the message area of the 2nd tab as it is taking the first tab message area as default , so i had put the following logic in the modifyview.
       <b>if(selectedTab.equals("Tab1"))
                 IWDMessageArea Tab2MsgArea =(IWDMessageArea) view.getElement("Tab1MessageArea");
                 Tab2MsgArea.setEnabled(false);
                 IWDMessageArea Tab1MsgArea =(IWDMessageArea) view.getElement("Tab1MessageArea");
                 Tab1MsgArea .setEnabled(true);          
            else
                IWDMessageArea Tab2MsgArea =(IWDMessageArea) view.getElement("Tab1MessageArea");
                 Tab2MsgArea.setEnabled(true);
                 IWDMessageArea Tab1MsgArea =(IWDMessageArea) view.getElement("Tab1MessageArea");
                 Tab1MsgArea .setEnabled(false);
            }</b>
       This logic is working fine for most of the cases , but When i selcect a TAB, in the event handler of the selection, i am performing some logic and raising exceptions, for these exceptions it is not working fine as my event handler is fired first before the "WDModifyView" . Is there any other way to control the "ENABLE" property of the MessageAreas.

  • How to disable the validity of a particular Role for 100 users, in a single

    Hi
    How to disable the validity of a particular Role
    which is assigned to 100 users. (disabling the role of change the validity of the role )
    at present am doing manually, by entering into each user and changing the validity of the role
    Thanks.

    > How to disable the validity of a particular Role for 100 users, in a single ...
    ... shot?
    Assign a reference user to the 100+ users and create events in the factory calendar which assigns and removes the role from the reference user only.
    The downside is that it is not scalable for many of the same concepts at the same time, because a dialog user can at one logon time only have one reference user assigned to them.
    Cheers,
    Julius

  • How to disable a pushbutton created in selection screen.

    How to disable a pushbutton created in selection screen.

    you can make it invisible during runtime.
    At the event,  AT SELECTION-SCREEN OUTPUT. you can turn attributes on and off for screen elements.  In this case, invisible = 1, makes the element invisible, 0 makes is visible.
    here is a short sample.
    report zrich_0001.
    parameters: p_check type c.
    selection-screen pushbutton 40(20) gocfg
                         user-command gocfg.
    at selection-screen output.
      loop at screen.
        if screen-name = 'GOCFG'.
          screen-invisible = '1'.
          modify screen.
        endif.
      endloop.
    Regards,
    Rich Heilman

  • How To Disable Verify Database Message Alert

    How To Disable Verify Database Message Alert?
    I have a VB6 open Crystal Reports using Crystal Reports XI R2 (SP5) and almost every time I open a report, I get an alert message about the table has been changed and I have to click "Ok" to make it goes away. Is there a way to  disabled this alert or set default to "Ok" so I do not have to  click this message every report. Thank you very  much.

    Hello,
    You must verify if the database has changed so you can't disable the message. CR must match what the DB is using or the reports will fail or return wrong data.
    It's odd that even after verifying the DB in the designer your app still needs it to be verify the report. You did save the report correct?
    Also:
    Dim CRApplication As CRAXDDRT.Application
    Dim Report As CRAXDDRT.Report
    Is the report creation engine and you should be using craxdrt.dll. You need to be licnesed to use craxddrt.dll and this may cause problems for you later when deploying.
    Use:
    Dim CRApplication As CRAXDRT.Application
    Dim Report As CRAXDRT.Report
    The mapping is not a switch you can turn on or off but it is Event driven. You need to add code to the viewer section to capture the event if the mapping event fires. Then you can set it to the way you want to use it.
    I suggest you purchase a case on line and get to the Report Design team to figure out why when you verify the report your app still thinks it needs to be verified. Something going on in your report that the forum makes it difficult to debug the problem. You can't attach files to forums.
    Link to Single Case purchase:
    http://store.businessobjects.com/store/bobjamer/DisplayProductByTypePage&parentCategoryID=&categoryID=11522300
    Thank you
    Don

  • How to disable/enable image property in Web Dynpro?

    Hi,
    I was trying to find a help about "How to disable/enable property of an image in Web Dynpro?" but never find it. Let me explain what I'm trying to do:
    I need to show three different status (Released, Rejected and Approved) each one is an image ... <b>How do I do to disable images property before a process and enable them after it?</b>
    Thanks in Advance, and waiting an answer As Soon As Possible !!!
    Tokio

    Your question is not completely clear to me. An image cannot trigger an event, so disabling it has no effect.
    To display different images in a Image element depending on some condition, you can use a calculated context attribute <i>imageSource </i>of type "string" that returns the URL of the image, something like
    public String getImageSource(IWDNodeElement element)
      if (...)
        return "image_for_status1";
      else if (...)
        return "image_for_status2";
      else if (...)
        return "image_for_status3";
      return ""; /* no image will appear */
    Bind property Image.<i>source </i>to attribute <i>imageSource</i>.
    If you put the three image files inside folder src/mimes/components/<componentName>, your method can simply return the file name without calculating an URL.
    Armin

  • Disable event firing while updating list item in custom timer job

    Hi
    I am adding new items in the list usign custom timer job.
    While adding the items in the list event receiver of another list (which is not related to list which is updating) is getiing fired due to which I am getting data wrongly updated and exceptions are comming.
    why the another lists event recevier is executing while updating my list?
    How can I disable event firing from timer job code?
    please suggest any solution

    Hello,
    It seems you have deployed your event receiver globally and it is applied to all the lists. I can suggest two ways:
    1. Either you update your event receiver feature.xml file and attached to specific list, wherever you want. You can follow below link to attach event with specific list via code:
    http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.speventreceiverdefinition.aspx
    Or instead of code you can also pass ListUrl in feature.xml file:
    http://msdn.microsoft.com/en-us/library/ff398052.aspx
    2. OR delete event receiver from the list: You can use below code in your timer job to delete event receiver
    http://sarangasl.blogspot.in/2009/11/remove-event-receiver-in-sharepoint.html
    Hope it could help
    Hemendra:Yesterday is just a memory,Tomorrow we may never see
    Please remember to mark the replies as answers if they help and unmark them if they provide no help

  • How to disable Refresh,Reload in browser and user should not allow to multiple browser sessions ?

    Dear All,
    How to disable Refresh,Reload in browser and end user should not allow to multiple browser sessions in portal.Where we need to configure the settings or any code in masthead or any other component. My server version is 7.4 - SP5 .Please help us.
    Thanks for advance,
    BR,
    Durga Rao.

    Dear all,
    i am able to logoff the click refresh button on keyboard.I am using this code to log off the user into the portal.
    document.onkeydown = function(e)
      var key;
      if (window.event) key = event.keyCode
      else
      var unicode = e.keyCode ? e.keyCode : e.charCode
      key = unicode
      switch (key)
      { //event.keyCode
      case 116: //F5 button
        LSAPI.sessionPlugin.logoff();
      event.returnValue = false;
      key = 0; //event.keyCode = 0;
      return false;
      case 82: //R button
      if (event.ctrlKey)
    LSAPI.sessionPlugin.logoff();
      event.returnValue = false;
      key = 0; //event.keyCode = 0;
      return false;
      case 91: // ctrl + R Button
    LSAPI.sessionPlugin.logoff();
      event.returnValue= false;
      key=0;
      return false;
    Thanks.
    But i am unable to control the multiple windows opening the browser.So any one can tell me the how to block the new window and new tab/duplicate tab option.
    BR,
    Durga Rao.

  • System restore - how to disable communication ?

    Hi,
    i would like to get some information on "how to disable the communication between "SAP  and SAP" and "SAP to nonSAP" System in case of a system restore.
    my requirements:
    - i need to disable SM59 RFC destination / Ports / Gateway
    - i need to disable webservice communication (SICF / LPCONFIG / etc)
    Is there a global switch do close the communication ?
    - Is it useful to set the (Batchjob-Profile = 0) that no BatchJob could be started ?
    - Is it useful to lock all users ? (except admin users)
    What about the event triggered IDocs. I think there is no Batchjob running ?
    How do you solve this in your company in case of a system restore and the communication must be closed ?
    Thanks in advance,
    Gordon

    Hi,
    1. Rfc connection : Temporarily you can give some garbage vale in user-id and password in "Logon and Security" in SM59 to make it not workable.
    2. Port settings : In We21, if Rfc connection itself is not working then corresponding port which is making use of this rfc, will also not work.
    3. Batch jobs : To completely deactivate a job from running , select the next job occurrence by searching its released status and then go to the tab Job> Released to Scheduled. This will stop the job from running again. However to terminate an active job, go to SM66 , Edit>Process-->restart after
    error>yes and then Process>cancel-->with core.
    Thanks,
    Asit Purbey.

  • UCM - WEBDAV - How to Disable the New Folder option in the action popup

    I am trying to implement WebDav functionality. I don't want the users to create folders in the folder mapped to a security group. As long as the user has privilege to contribute to the security group he/she can checkin documents but they should not be able to create folder under it. I did not find documentation as to how to disable the new folder option in the context action menu that pops up on mouse right click. Is there any way we can do that?
    Thanx.
    Edited by: user10991492 on Nov 1, 2010 11:24 AM

    This is the boilerplate text often used in connection to networks in general. It is impossible to troubleshoot someone else's network remotely, and that's why it's not supported by Adobe:
    If you are opening files over a network or saving them to a network server, please cease and desist immediately in the event you are currently experiencing problems with one or more files.
    Working across a network in general is not supported by Adobe.
    See: 
    http://kb2.adobe.com/cps/406/kb406793.html
      Copy the CLOSED file from your server to your local hard disk, work on it, save it again to your local hard disk, close it, and copy the closed file back to the server.
        Of course, the fact that Adobe does not support working across a network does not necessarily mean it won't work.  It should.
        Adobe's position is that there are too many variables in a network environment for them to guarantee that everything will work correctly in every network, especially given the fact that if something does not work properly, it's probably the network's fault, and Adobe has no way of troubleshooting your network.
      If you can't work locally, you are on your own, and if something happens, you're on your own. If you must work from a server, make sure your network administrator is a competent professional.

Maybe you are looking for