Intercept a mouseclick event with a background running application

Ciao to everyone.
My name is Alessandro and "i have a problem"...
I want to count every click of my mouse with an application running in background.
How can i intercept any mouseclick event, also those occurring out of the application?
I work with Windows XP.
Thanks and excuse me for my bad english.

As far as we know when a Java swing application loses focus you can not handle the click being generated by the user.
Have a look at the following source:
http://java.sun.com/docs/books/tutorial/uiswing/events/mouselistener.html
We have developed routines for that kind of handling in C+ and set up java JNI in order to retrieve them, but they are low level routines that need to handle interruptions from the main board (not recomended for average users).
Answer provided by http://www.consultoriajava.com

Similar Messages

  • Using getRuntime().exec() with Serlvet to run applications in Solaris

    I am currently doing a project which requires the execution of Solaris applications through the use of Java Servlet with this Runtime method - Runtime.getRuntime.exec()
    This means that if the client PC tries to access the servlet in the server PC, an application is supposed to be executed and launched on the server PC itself. Actually, the servlet part is not an issue as the main problem is the executing of applications in different platforms which is a big headache.
    When I tried running this program on a Windows 2000 machine, it works perfectly fine. However, when I tried it on a Solaris machine, nothing happens. And I mean nothing... no errors, no nothing. I really don't know what's wrong.
    Here's the code.
    public void doPost(HttpServletRequest request, HttpServletResponse response)
    throws ServletException, IOException
    response.setContentType("text/html");
    PrintWriter out = response.getWriter();
    Process process; Runtime runtime = Runtime.getRuntime();
    String com= "sh /opt/home/acrobat/";
    String program = request.getParameter("program");
    try
    process = runtime.exec(com);
    catch (Exception e)
    out.println(e);
    It works under Windows when com = "c:\winnt\system32\notepad.exe"
    When under Solaris, I have tried everything possible. For example, the launching of the application acrobat.
    com = "/opt/home/acrobat"
    com = "sh /opt/home/acrobat"I have also tried reading in the process and then printing it out. It doesn't work either. It only works when excuting commands like 'ls'
    BufferedReader read = new BufferedReader(new InputStreamReader(process.getInputStream()));Why is it such a breeze to execute prgrams under Windows while there are so many problems under Solaris.
    Can some experts please please PLEASE point out the errors and give me some advice and help to make this program work under Solaris! Please... I really need to do this!!
    My email address - [email protected]
    I appreciate it.
    By the way, I'm coding and compiling in a Windows 2000 machine before ftp'ing the .class file to the Solaris server machine to run.

    Hi!
    I'm no expert, but I think I remember doing something similar a few months ago, and I think the problem was that the UNIX server does not know which shell to use. The solution was this:
    Create a script that starts the program on the server, and be sure to include a first row saying:
    #!/bin/ksh
    to specify which shell to use (in this case Korn shell). Then call the script from Runtime.getRuntime().exec()

  • Is there any solution for windows 7 to avoid focus stealing problem as some background running applications are stealing focus from current windows.

    To reproduce the focus stealing you can follow these steps
    1. Go to following link and click on 'Try it'    
    2. Before the popup is displayed from the above page switch to another application like notepad and start typing.
    3. When popup is displayed in #1 your keyboard focus should remain in the notepad.
    we have some other java applications which are stealing the focus from current work and creating this disturbance.
    Could you please let us know if there is any solution or work around to solve this issue.
    Thanks,
    <p style="border:0px;margin-bottom:0px;padding-right:0px;padding-left:0px;vertical-align:top;-webkit-font-smoothing:antialiased;min-height:

    Hi,
    I think this issue is focused on java application development or software which supports the development, while this forum is mainly discussing issue about Windows 7 performance rather than development issues, I suggest you contact support in this forum,
    thanks for your support
    MSDN Forum
    http://social.msdn.microsoft.com/Forums/en-US/home?sort=relevancedesc&brandIgnore=True&searchTerm=java+application+
    Yolanda Zhu
    TechNet Community Support

  • My 2011 MBP has begun running slow with frequent 'spinning beach ball' events. I'm running Yosemite and wondered if I should of use the original install disk for maintenance.

    My 2011 MBP has begun running slow with frequent 'spinning beach ball' events. I'm running Yosemite and wondered if I should of use the original install disk for a maintenance reinstall. I presume I'd have to download Yosemite again, though I'd be happy just using Snow Leopard again too.
    Thanks for the help.

    When you see a beachball cursor or the slowness is especially bad, note the exact time: hour, minute, second.  
    These instructions must be carried out as an administrator. If you have only one user account, you are the administrator.
    Launch the Console application in any of the following ways:
    ☞ Enter the first few letters of its name into a Spotlight search. Select it in the results (it should be at the top.)
    ☞ In the Finder, select Go ▹ Utilities from the menu bar, or press the key combination shift-command-U. The application is in the folder that opens.
    ☞ Open LaunchPad and start typing the name.
    The title of the Console window should be All Messages. If it isn't, select
              SYSTEM LOG QUERIES ▹ All Messages
    from the log list on the left. If you don't see that list, select
              View ▹ Show Log List
    from the menu bar at the top of the screen.
    Each message in the log begins with the date and time when it was entered. Scroll back to the time you noted above.
    Select the messages entered from then until the end of the episode, or until they start to repeat, whichever comes first.
    Copy the messages to the Clipboard by pressing the key combination command-C. Paste into a reply to this message by pressing command-V.
    The log contains a vast amount of information, almost all of it useless for solving any particular problem. When posting a log extract, be selective. A few dozen lines are almost always more than enough.
    Please don't indiscriminately dump thousands of lines from the log into this discussion.
    Please don't post screenshots of log messages—post the text.
    Some private information, such as your name, may appear in the log. Anonymize before posting.

  • What is wrong with the mouseClicked event?

    there is a weird problem with my program: I constructed a panel with two componets(I constructed a new class for the component that extends TextArea);Both components are registered in a mouseClicked event(when I click the component, the text in the component will display).Eveything seems OK when I click one component first.But when I click other one, the text in the component will display twice,like I click twice. if I go back to first component,the text in the first one will display three times, like I clicked three times and so on.
    Does anybody can give me some hints?
    thanks in advance

    please check the codes related to event:
    public class VectorCellEditor extends MultilineCellEditor implements MouseListener
              public VectorCellEditor()
                   super();
              public void initialize( InitialEvent ev,CellInfo info,Object o)
                   String str="";
                   if(o==null)
                        str ="";
                   else if(o instanceof String)
                        str =(String)o;
                   else if(o instanceof Vector)
                        String dateString =((Data)(((Vector)o).firstElement())).getDateString();
                        String dataString="";
                        for( int i = 0;i<((Vector)o).size();i++)
                             dataString = dataString+((Data)((Vector)o).elementAt(i)).toString()+"\n";
                        str = dateString+"\n"+dataString;
                   super.initialize(ev,info,str);
                   super.setEditable(false);
                   addMouseListener(this);
              public void mousePressed(MouseEvent e){}
              public void mouseReleased(MouseEvent e){}
              public void mouseEntered(MouseEvent e){}
              public void mouseExited(MouseEvent e)
              public void mouseMoved(MouseEvent e){}
              public void mouseClicked(MouseEvent e)
                   String s = this.getText();
                   calendar.area.append(s);
         }

  • How do I assign a mouseclick event Listener to a simplebutton already nested in a movie clip when it's dropped on stage?

    I'm trying to assign a mouseclick event listener to a simplebutton nested within a movie clip's later frames, starting at frame 2 and up. This card, however, is not added to my game until later, and when the player clicks on it/turns it over.
    There are four files involved in this program:
    #1 The main actionscript file, which corresponds to
    #2 my dreamQuester .fla file.
    #3 my artifactCard file movieClip's corresponding .as file,
    #4 my combo1.as file corresponding to a an instance of a simpleButton named combo1 that is already
    nested --and this instance is already named-- inside/as a child of said artifactCard movieclip.
    What I've done so far isn't working:
    In my main dreamQuester.as file, when a player clicks on an artifactCard, its MOUSE_DOWN event
    listener takes them to this function (clickArtCard), where the trouble is at:
    // player clicked on the artC card--which is a child of posArt1 on stage--to turn card over:
            function clickArtCard(a_event:MouseEvent) {
                var thisArtCard:artifactCard = (a_event.target as artifactCard);
                thisArtCard.gotoAndStop(unclickedArt1);  // go to frame number of artifact
                                    // card where combo1 button is.
                thisArtCard.removeEventListener(MouseEvent.CLICK,clickArtCard);
                thisArtCard.buttonMode = false;
                trace("combo1.combo is:" + combo1.combo);
                trace("posArt1.artC.combo1 is:" + posArt1.artC.combo1);
                posArt1.artC.combo1.addEventListener(MouseEvent.MOUSE_DOWN, comboClickedWHO);
    when the artC card--the static public instance of artifactCard--is clicked, it only gets to the
    trace("posArt1.artC.combo1 is:" + posArt1.artC.combo1); which returns this error message:  
    TypeError: Error #1010: A term is undefined and has no properties.
        at MethodInfo-61()
    So do how would I declare a static public variable of this simpleButton at the start of my main .as
    file to make it defined to get a mouseDown actionListener into my pre-existing-and-named-instance
    combo1 simpleButton?
    perhaps there is a way, while the debug movie program is running, to click on the simpleButton and see exactly
    what it's parent heirarchy is, to see the name of all parents above the simpleButton incase they are
    different then what I think?
    (just in case, I was hoping to squeeze a zip file containing these files to be less than 9MB incase someone was willing to look at my files to see what I've done so far, but 9 megs is just too big! even though all graphics I've imported where turned into vector graphics with trace bitmap. I wish there was a way to check the file size of each symbol in Flash CS4, here...)
    Thank you so much for any help!
    ~Ethan

    Just use a
    stage.addEventListener(KeyboardEvent.KEY_DOWN, keyPressed);
    function keyPressed(event:KeyboardEvent):void {
         //trace(event.keyCode);
         if(event.keyCode == ???){
              // play the sound
    Where I show the "???" you would replace with the keyCode for the key you want pressed for that sound.  To determine the keyCode you can use the trace line that I have commented out.
    Note that when testing in Flash you often need to disable the keyboard shortcuts in the Flash Player in order to be able to use alot of the keys.  You will find this option in the Control menu options in the player.

  • MouseClicked event

    I have been having some inconsistencies with mouseEvents not firing. I have a mouseClicked event handler assigned to a radio button within a JTable. Occasionally it does not register clicks of the mouse - which obviously causes all manner of problems. I have traced the problem down and it appears to be that the mouseClicked is affected by moving the mouse between pressing and releasing - even if the mouse doesnt exit the radio button (mouseExited). I have got around this by changing to a mouseReleased but my question is:
    Is this the normal behaviour or is there some sort of bug or perhaps some problem with the way they are being used.
    I have researched further and this seems to happen to not just be tied to my circumstances - if you go to this address and run the MouseEventDemo you will see that if you move the mouse between clicking and releasing no mouseClicked event fires: http://java.sun.com/docs/books/tutorial/uiswing/events/mouselistener.html
    Or am i being stupid?

    Hi georgemc,
    With regards to whether its best to use with a radio button - probably not but that was just one example of where it is being used. The reason in that case i have needed to use a mouse event on the radio button is to be honest because i cant get a radio button correctly set up within my JTable and so i have had to create an extra column with another radio button and then emulate a radio buttongroup by having the negation of the boolean of the selected radio button set as the value of the other by my mouse listener! This mouse listener also caches changes for later saving back to db
    In an ideal world i would have these two columns in a button group or possibly even better have on bit of data being represented as a pair of radio buttons
    What type of listener would you suggest in the hypothetical situation that i had a working set of radio buttons within a JTable?

  • Creating animations with transparent backgrounds?

    I'm running into some problems when using After Effects to create animations with transparent backgrounds for Keynote...
    I use animated gifs and short quicktime movies with uniform backgrounds as source files, use color keying to take out the backgrounds, preview them to see if they look OK, render the results as RGB+alpha, and... they don't show up as transparent in Keynote. They work in Powerpoint, however. I've tried outputting as .mov, as .gif, as premultiplied vs straight alpha... no joy. Can someone explain (or point me to an explanation) of how Keynote differs from other programs in its handling of transparency? What am I missing?

    Using a TYPE_INT_ARGB BufferedImage worked beautifully. I had played around with Image for hours, but it never occurred to me that BufferedImage would be needed. :)
    many, many thanks,
    Steven

  • How to handle mouseclicked events in a ListView node correctly?

    Hi
    We want to simulate table rows and headers with a ListView. We have an additional requirement that when a particular row is selected, a X icon will appear at the last column. Clicking which will remove the row from the table.
    A snippet from the implementation is given below
    public class SampleList extends ListView{
        function getRow(row :Row, index:Integer, cell:ListCell):Node {         
             HBox {
                    var closeView : Image
                    content : [
                    Label {textWrap:true, text: bind row.id, layoutInfo: bind LayoutInfo {width:width * .2, height:height * .02 }}, //some column 1
                    Label {textWrap:true, text: bind row.name, layoutInfo: bind LayoutInfo {width:width * .12, height:height * .02 }}, //some column 2                                               
                    close = ImageView {
                                            image : Image{url:"close.png"}
                                            disable: bind cell.selected and not cell.empty
                                            pickOnBounds : true                                   
                                            onMouseClicked : function (event):Void{
                                              if (not close.disable)
                                            //delete from row from model (Row)
                                            } //close column
         override var cellFactory =  function () {     
                def cell : ListCell = ListCell {       
                onUpdate:  function() {                    
                        def item = cell.item;              
                        cell.node = if (item == null) null; else getRow(cell.item as Row, cell.index,cell);                                          
    }      The problem with the code is that the mouse clicked event used by the close button is multiplexed - Firstly - the application logic - it is used to delete the row from the model and secondly - the ListView control - uses it to trigger a item selection internally. As a result, if you click on a row which is not yet selected (in the sense that it is highlighted) at the exact location of the X icon, the row is deleted without it having been ever highlighted
    If you note the code above, you will notice that the close image's mouseclicked event checks cell.selected before deleting it. And cell.selected is true even though the list has not been highlighted
    Any workarounds for this problem would be appreciated
    Thanks
    Dhruva

    User, please always tell us your jdev version.
    In general you use a valueChangeListener which is fired when the user tabs out of the field...
    Timo

  • I think I downloaded a fake Firefox update from supportfirefox.perl.sh - ever since I have had I/E popups and now audio playing with no programs running. What do I do?

    I use the Firefox Google as my homepage. I searched for something and it went to the "you need to update your firefox" so I did...then I realized that it wasn't processing the update the way a normal update from Firefox would. Ever since then, I have had Internet Explorer PopUps and now I have audio running even though there is no program for it to be running on...like a webpage running in the background.

    Do a full scan with your Anti-Virus application.
    Then do scans with different Malware applications.
    Install, update, and run these programs in this order. '''''(Not all programs detect the same Malware.)''''' They are all free for personal use, but some have limited functionality in the "free mode" - but those are features you really don't need to find and remove the problem that you have.<br />
    ''Note: If your Malware infection is bad enough and you are mis-directed to URL's other than what is posted, you may have to use a different PC to download these programs and use a USB stick to transfer them to the afflicted PC.''
    Malwarebytes' Anti-Malware - [http://www.malwarebytes.org/mbam.php] <br />
    SuperAntispyware - [http://www.superantispyware.com/] <br />
    AdAware - [http://www.lavasoftusa.com/software/adaware/] <br />
    Spybot Search & Destroy - [http://www.safer-networking.org/en/index.html] <br />
    Windows Defender: Home Page - [http://www.microsoft.com/windows/products/winfamily/defender/default.mspx]
    If these don't find it or can't clear it, post in one of these forums for specialized malware removal help: <br />
    [http://www.spywarewarrior.com/index.php] <br />
    [http://forum.aumha.org/] <br />
    [http://www.spywareinfoforum.com/] <br />
    [http://bleepingcomputer.com]

  • Need to know how to find out the Variant associated with a background job

    Hello,
    Plz help me in finding out how to find the variant associated with a background job. I need to know which variant does the program picks up when it runs the scheduled background job. There are so many variants that exist. How do I figure out which one is being picked up by the program. When I go and see into the job that are already finished it shows the parameter as "&00000000645354" which I do not understand what it corresponds to. I was expecting a variant name instead of this number in the parameter field. Is there a way I can find out the name of teh variant the program is using automatically in the background job ??
    Thanks in anticipation

    Yes it is possible which is variant, input fields are choosen
    - go to SM37 and locate the background job which was processed using proper selection criteria
    - select the Job and click on 'Step' button availabe in the screen
    - the new screen is 'step list overview'. now, place the cursor on selected variant avaialble on the screen, then from Menu >> Goto>> variant
    which gives the list of input values.
    hope this helps
    Thanks
    JK

  • How to cancel an edit to an iCal event with attendees

    I keep running into this--
    - Open an existing event with attendees
    - Make an edit of some kind
    - Change your mind
    - Forget what changes you made and/or not wish to let everyone already invited know that iCal is sometimes as crappy as Outlook.
    - Only have the options to keep editing or send/update (i.e. send the updates to everyone)
    There are lots of discussions about this:
    https://discussions.apple.com/message/10084804#10084804
    https://discussions.apple.com/message/10929297#10929297
    https://discussions.apple.com/message/10760583?messageID=10760583
    https://discussions.apple.com/message/10471977?messageID=10471977&amp%3b#1047197 7
    The concensus seems to be that you can't do it.
    However this seems to work for me (when I'm desparate):
    Quit iCal
    Go to the "Library" folder in your home directory, then to the "Calendars" folder  (i.e. ~/Library/Calendars)
    Delete the files "Calendar Cache~" and "Calendar Cache~"  (you don't need to empty your trash)
    Reopen iCal.  It will resync the calendar.
    I've only tried this with Exchange calendar items that have already synced with the server, so your milage may vary.  I suppose it's possible that you may lose data this way.
    Hope this helps someone since it doesn't seem like Apple is going to fix this anytime soon!

    In step 3 above I said delete "Calendar Cache~" twice.  I meant: delete "Calendar Cache" and also "Calendar Cache~" if that exists as well.

  • Framing image with transparent background png frame

    hi,
    i'm trying to find a way to frame images with transparent background png frames...
    what i'm doing now is
    1-drawing my image on a panel
    2-creating a 2nd image using the frame's filename, stretching this 'frame-image' to a size slighlty larger than that of my main image and drawing the 'frame-image'
    the problems with this method are:
    1-depending on the width of the frame, the frame sometimes hides parts of the image (thick frame), and sometimes there is a gap between the frame and the image (thin frame).
    2-if the image file containing the frame is larger than the frame (Ex: The image is 300x300, the frame is centered in this image and is 200x200; as opposed to the image is 200x200 and the frame takes up all the space), when i position the 'frame-image' near the top left corner of the image i want to frame, the frame appears at the wrong place (shifted down and to the right). This is due to the fact that i'm placing the top corner of the created 'frame-image' and not the frame, who is not in the top corner of my 'frame-image'.
    Is there a way to do what i'm trying to do???
    My ideas (which i don't know how to achieve are)
    1-To 'analyse' my transparent background png file and
         1-only keep the frame,
         2-calculate the frame's thickness
    OR
    2-Let java do the analyzing for me and tell it to frame my image with the frame in the png file
    please feel free to ask for more explanations if my description/question is confusing,
    thanks.

    Have you looked into the Border interface? If what you really want to do
    is put a custom border on a component, you may be able to do it this way.
    Anyway, here is some code that stacks and centres 2 images. It's not hard to do.
    import java.awt.*;
    import java.awt.image.*;
    import java.io.*;
    import java.net.*;
    import javax.imageio.*;
    import javax.swing.*;
    public class Example extends JComponent {
        private BufferedImage backgroundImage;
        private BufferedImage foregroundImage;
        public Example(BufferedImage backgroundImage, BufferedImage foregroundImage) {
            this.backgroundImage = backgroundImage;
            this.foregroundImage = foregroundImage;
        public Dimension getPreferredSize() {
            int w = backgroundImage.getWidth();
            int h = backgroundImage.getHeight();
            return new Dimension(w, h); //assuming this is bigger
        protected void paintComponent(Graphics g) {
            super.paintComponent(g);
            int w = getWidth();
            int h = getHeight();
            //paint both, centred
            int x0 = (w-backgroundImage.getWidth())/2, y0 = (h-backgroundImage.getHeight())/2;
            g.drawImage(backgroundImage, x0, y0, null);
            int x1 = (w-foregroundImage.getWidth())/2, y1 = (h-foregroundImage.getHeight())/2;
            g.drawImage(foregroundImage, x1, y1, null);
        public static void main(String[] args) throws IOException {
            URL url1 = new URL("http://weblogs.java.net/jag/Image54-large.jpeg");
            URL url2 = new URL("http://weblogs.java.net/jag/DukeSaltimbanqueSmall.jpeg");
            JComponent comp = new Example(ImageIO.read(url1), ImageIO.read(url2));
            final JFrame f = new JFrame();
            f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            f.getContentPane().add(comp);
            f.pack();
            SwingUtilities.invokeLater(new Runnable(){
                public void run() {
                    f.setLocationRelativeTo(null);
                    f.setVisible(true);
    }

  • When I run activity monitor with no programs running my dock shows fluctuating usage...between 4% up to 20%.  Random figures that come and go with corresponding CPU usage.  A little help?

    My activity monitor show random and fluctuating CPU usage at the Dock site with absolutelyno programs running.  %'s fluctuate between 3 - 20 and they pretty much come and go.  What might be causing this?

    There's a lot of background processes running that aren't documented as Apps as such. And some of them are the Time Machine backups, Spotlight searches, all kinds of small little bits of maintenance caches, there's a lot going on. So it's not completely out of the question that this is 'normal' for a Mac. If it were 50% or more I would be concerned but if it spikes up to 20% for a second or two you are probably not in any trouble of any kind.

  • MouseClicked event = enter key doesnt work

    Hello,
    when I make some JButoon and add to it MouseClicked event (witch handles some code) everything works fine. But when I mark it with TAB then press ENTER button wont "doClick".
    So I found out that actionPerformed might be the right handler, but I dont understand why there is also mouseClicked event?
    Is actionPerformed event what I need (to work either with LMB or ENTER key) ?
    Are there any disatvantages of actionPerformed event comparing to mouseClicked event?

    The spacebar, not the Enter key, is the default keyboard trigger for a button that has the focus (and not just in Java).
    If you really want the focused button to respond to the Enter key, search this forum for"DefaultButtonFollowsFocus".
    db

Maybe you are looking for