Detect mouse clicks or keyboard events on desktop or everywhere

Hi,
What I have to do is to start the application minimized in the system tray. Then the application must be listening for crtl+shift+left mouse click in any part of the desktop or an opened application, when that happens, I have to show a window asking if the user want to take a screenshot starting in the x,y point he clicked and then take the screenshot.
What I don't know how to do is to detect the mouse and keyboard events when the application is supposed to be running minimized in the system tray.
How can I do that? Can anybody give me a hint?
Thanks in advance.

It's not possible with plain Java. You will need native code for this. Take a look at JNA.

Similar Messages

  • How to detect mouse clicks on desktop?

    Hi All,
    I need to detect mouse clicks on the desktop and find out mouse position on the screen. How to listen to mouse events if I don't have any swing components like containers, panels, windows, etc? All things like "addMouseListener" are supposed to be with such components. But my program is running in the background and it doesn't have any graphical interfaces. So, I need to detect if a mouse button is pressed at any position on the screen.
    Thanks for any help!

    Why? What program feature do you intend to offer, by knowing what a user clicks on (besides the application itself).Hi, well what I have to do is to start the application minimized in the system tray. Then the application must be listening for crtl+shift+left click in any part of the desktop or an opened application, when that happens, I have to show a window asking if the user want to take a screenshot starting in the x,y point he clicked, once done, I have to take an screenshot...so on.
    How can I do that? Can anybody give me a hint? Thanks in advance.

  • Detecting mouse clicks in editable cell of JTable

    Hi everyone :)
    I thought that this question might have been asked before, but I have searched the forums extensively and have not been able to find the solution.
    What I want to achieve is to detect single and double mouse clicks on JTable cells (that are editable).
    For example, I have a JTable and there exists within it an editable cell. If the user clicks on it once then that cell goes into edit mode, and the user can type directly into the cell. I have already successfully implemented this.
    However, what I also want to do is detect a double-click so that I can pop up a dilaog that shows a list of default values that the user can select.
    So here is what I want;
    1. User clicks on the cell once.
    2. Cell moves into edit mode.
    3. If the user clicks again within a certain time interval then cancel edit mode and pop up a dialog containing values that the user can select from.
    I think that to do this I need to be able to detect mouse clicks on the cell that is currently being edited. So far I have been unable to discover how this is done. I have even tried extending JTextField to get what I want, but with no luck.
    Any help would be greatly appreciated.
    Kind regards,
    Ben Deany

    Thanks for the reply.
    Unfortunately, it is not possible to call 'AddMouseListener()' on a cell editor. You are only able to call 'addCellEditorListener()' and that only allows two events to the broadcast (edit cancel, and edit stop).
    Ben

  • Lose control of mouse clicker and keyboard

    When I boot up and the desktop appears everything works fine for the first 5-10 seconds, then I find I cannot use mouse clicker or keyboard. Can still move curser, however. Does anyone have any suggestions? Thanks

    Welcome to the Apple forums.
    If you could post what Mac OS you are running, how much memory you have, what Hard drive you are using, that would help folks respond to your query.

  • Using Firefox 3.6 after a few mouse click/ keyboard input the firefox window is no more active, mouse click and keyboard input is inactive ; then I click on the taskbar and the keyboard is active again during a few click then it stops again etc.

    Using Firefox 3.6 after a few mouse click/ keyboard input the firefox window is no more active, mouse click and keyboard input is inactive ;
    to solve it I click on the taskbar and the keyboard is active again during a few click then it does not work any more and I click again on the task bar etc.
    after several repetitions, I have to call the task manager alt+del+ctrl, then come back to the firefox window to be able to use keyboard and mouse again

    Attaching the picture for the tab shape I want...

  • How to detect mouse click event?

    Hello,
    I would like to have a vi to detect left, right and no mouse click. I mean that in the vi attached, Button2 should be 0 (no click), 1 (left c.) or 2 (right c.) depending on the event occured in i-1. cycle. My vi is the modyfied version of the one found here:
    http://www.ni.com/example/27663/en/
    Sometimes it works fine, but another time nothing happens when I click.
    I think the main problem is with the execution times at the for loop and event structure.
    Could you help me how to deal with the problem?
    Thanks you!
    Attachments:
    mouse1.vi ‏12 KB

    Hi VampireEmpire,
    Your For loop iterates twice. If an event occures during first iteration everything is fine - Button 2 refreshes during second iteration. But what happens when an event occures during second iteration? Does Button 2 have a possibility to refresh? 
    1. Do you see the problem now?
    2. And if you do - do you really need For loop? I would suggest you trying removing it and connecting shift register to the while loop.
    Bluesheep

  • Simulate mouse clicks with keyboard

    Hello,
    I'd like to create a little tool in JAVA that would simulate a mouseclick when I pressed a key on the keyboard.
    But that should be valid even when I have any other program as active (selected).
    Can that be done in Java or Java can only listen to events generated when the java application is active?
    If you have working code that would be very appreciated.
    Thank you in advance,
    Nuno Vidal

    Ok... have never done anythong with JNI before, can
    you give me an insight?The way I would do it would be to write a system wide keyboard hook, (which you can't do in Java and should do in C++)into a JNI dll as smg123 said. Then you will have that method notify your java program on a key press and from your Java program you can use the Robot class to send a mouse click or since your already using a native code you could write a C++ function to do it and invoke that from your Java app.

  • Detecting mouse click on a line

    I'm learning making GUI apps in Java.
    Here is my problem. Suppose I draw a line on a JPanel. If I want to find out if the line is clicked or not, what is the best way to do it?
    I did some research, looked at API. If I suppose my line is Line2D, then since its a line it doesn't have an area, so its contains method always returns false (..from API). So i dig around some more and came up with the solution of getting the shape from the stroke and calling its contains method.
    This is a code for what i mean..
    private Line2D.Double testLine;
    //mouse clicked event
    public void mouseClicked(MouseEvent e) {
            int x = e.getX();
            int y = e.getY();
            BasicStroke stroke = new BasicStroke(4);
            Shape testShape = stroke.createStrokedShape(testLine);
            if(testShape.contains(x,y)){
                System.out.println("this will be printed if clicked on line");
        }Well, the above solution works fine.
    Is it the right way of doing it or is there a better way around for this?
    Any help will be appreciated.
    Thanks.

    When trying to test if a line was pressed I usually test if the distance between the mouse coordinates and the line is smaller than some constant (usually 5 pixels).
    For this you have to write your own code to calculate the distance between a point and a line.

  • CP 6 Video mode: mouse click effects, keyboard tap sounds

    CP 6 capturing Video mode
    How do I set mouse click effects and keyboard tap sounds?
    Of course these settings surely cannot be set on a per slide basis as video mode does not have slides but why I'm not able to set them on a project basis?
    thanks

    Video mode is pure video. You can change some properties of the mouse (Choose Edit, Edit Mouse Points and when selecting one of the mouse objects look in its Properties panel, Options accordion. This accordion has the small curved arrow top right that you can use to apply the changes to all mouse objects.
    I'm not sure what you mean by 'keyboard tap sounds' at all? There is no way to add an interactive object, where you would be able to click, so what is the meaning of taps in that case?
    Lilybiri

  • Detect mouse click in FlashPlayer ActiveX

    I'm hosting the FlashPlayer ActiveX control (Flash9f.ocx) in
    a VB 6 application. The OCX exposes the following events:
    FlashCall, OnProgress, OnReadyStateChange and FSCommand. It does
    not expose the traditional Click, MouseUp or MouseDown events (for
    example) so is there a way to receive mouse click events in the
    hosted application?
    Also, I am unable to find any documentation on the FlashCall
    event. Any ideas what it is and how it works?
    Thanks to any and all.

    jList1.addMouseListener(new java.awt.event.MouseAdapter() {
    public void mouseClicked(MouseEvent e) {
    jList1_mouseClicked(e);
    public void jList1_mouseClicked(MouseEvent e){
    JOptionPane.showMessageDialog(null,"test"); }
    I got it. Thanks.
    I forgot to add the MouseListener initally

  • I want to detect mouse click on JTextFild

    I want do some opration on JTextField when
    Click on JextField how should i do that
    please tell me
    Rahul

    Quit cluttering the forum by posting your question 4 times.
    You've already been given the answer in one of your posting, but you've you've made so many postings on the same topic that you can't even find your original posting.

  • In Flashplayer, I can crossover mouse and keyboard events. In IrfanView I cannot. Can this be fixed?

    My client uses IrfanView to play SWF files. Unfortunately, he does not use Flashplayer. In Flashplayer, I can crossover mouse and keyboard events with no problem. In IrfanView, the second I click a button, the keyboard events are disabled. Is there a fix?

    Hi Ned. I may have posted this issue a bit early, but this problem is also happening in Flashplayer 10. It's not exclusive to IrfanView.
    Here is something that I encountered during my testing, when I jump to scene 6 using the menu button, I have a play button to jump from one frame to the next frame that stops -- the keyboard events start working. But if all I am doing is jumping scene to scene with the mouse button, the keyboard events are disabled.
    I feel as if the keyboard events only work if I am playing frames in the scene. And if all I am doing is jumping scene to scene using the buttons, the keys will disable.
    I set up the mouse buttons inside a movieclip that all the scenes share. The mouse actionscript is in the movieclip. On the main timeline of each scene is an actionscript for the keyboard events, even though I had to change each function name.
    I feel the actionscript is setup pretty simple. I just wish clicking the buttons would not disable the keyboard events. This may sound redundant, but the keyboard events do the same thing if you use the mouse buttons. It's just preference for the client even though he will need to understand that using the mouse buttons override the keyboard events. He doesn't really lose functionality.
    Keyboard actionscripting below:
    import flash.events.KeyboardEvent;
    stage.addEventListener(KeyboardEvent.KEY_DOWN, onKeyEvent);
    function onKeyEvent(e:KeyboardEvent):void {
    var character:String=String.fromCharCode(e.charCode);
    if (e.keyCode==72) {
      gotoAndStop(1,"master");
    if (e.charCode==49) {
      gotoAndPlay(1,"Distributor");
    if (e.charCode==50) {
      gotoAndPlay(1,"Mirka");
    if (e.charCode==51) {
      gotoAndPlay(1,"Farm");
    if (e.charCode==52) {
      gotoAndPlay(1,"Check2");
    if (e.charCode==53) {
      gotoAndPlay(1,"Check3");
    if (e.charCode==54) {
      gotoAndPlay(1,"Scene2");
    if (e.charCode==55) {
      gotoAndPlay(1,"Scene1");

  • Mouse click on graph without event handling

    Is there a way to detect mouse click on a graph without the event handling? My base version of LabVIEW does not have event handling features.
    Thanks,
    Ryan
    Solved!
    Go to Solution.

    Leaving out the Event Structure seems like cruel and unusual punishment.  My scorn is divided about 80/20 between NI for selling it and whoever tried to save a few bucks by buying it and then sticking it to you to workaround.  Perhaps you are a student in which case you are free labor and it is all good.
    Maybe your boss is a purist and dislikes Event Structures because they break the dataflow paradigm.  The alternative is of course polling, and in this case you have plenty of data flowing!  Unfortunately 99.9% of it is worthless.  Here is a little example in LV8.2 (don't know your version) that uses polling to check on the mouse button.  I only added a simple check for the button being pressed, if you want to know click (down/up) you can add a shift register and look for transitions in the button.  I do check that the front panel is up front, otherwise it will still register clicks even though you may be surfing the web.
    Hopefully everything is in the base package.
    Attachments:
    MouseClickNoEvent.vi ‏26 KB

  • Can a right mouse click be simulated from keyboard ?

    When a cell has focus and I click the right mouse button, I pop up a JPopupMenu. I would like to simulate a right mouse click using some keystroke combination from the keyboard. Is this possible ?

    You can Grab key pressed even then try to create new Mouse right click event from there somethng like that
    MouseEvent= new MouseEvent(Component source, int id, long when, int modifiers, int x, int y, int clickCount, boolean popupTrigger)
    source - the Component that originated the event
    id - the integer that identifies the event
    when - a long int that gives the time the event occurred
    modifiers - the modifier keys down during event (shift, ctrl, alt, meta)
    x - the horizontal x coordinate for the mouse location
    y - the vertical y coordinate for the mouse location
    clickCount - the number of mouse clicks associated with event
    popupTrigger - a boolean, true if this event is a trigger for a popup-menu
    You can pass Id it hing that will decide wheather it is right or left click

  • Detecting a mouse click on any (all) child components...

    Hey All,
    I am writing a number of compound GUI elements that i want to make focusable when you click any part of them. (i.e. a JTextArea inside a JScrollPane, coupled to a JTextField to provide input to the JTextArea).
    Is there an easy way to detect mouse clicks on child components of a JPanel?
    My current code is:
    m_oInputBox.addMouseListener(this);
    m_oOutputBox.addMouseListener(this);
    m_oScrollPane.getVerticalScrollBar().addMouseListener(this);
    This detects most of the mouse clicks, but not those on the buttons that form the scroll bar ends or the scroll bar slider when it is present.
    Any way tou can detect clicks on these too??
    Iso

    P.S. It does actually detect clicks on the scroll bar slider - just not onthe buttons that form the slider end caps (up/down).
    Iso

Maybe you are looking for

  • Error which validating selection screen data in subroutine

    Hi,this is my code selection-screen begin of block b_selection with frame title text-001. SELECT-OPTIONS: s_belnr for  rbkp-belnr,                                         "Invoice number                 s_gjahr for rbkp-gjahr NO-EXTENSION NO INTERVAL

  • I currently have Trend Micro...Does Firefox handle all the security issues like pfishing and viruses etc...I would like to cancel the other

    I cannot seem to get anyone to help me because I have asked this same question more than 6 or 7 times. Does Firefox handle all the security issues like pfishing and viruses, worms from attaching to my computer??????

  • Ipod Crashes in Vista but Fine on XP??

    I have upgraded to a 5th gen ipod. I connected it to my Vista pc, installed latest itunes(7)and all seemed well, until I recieved the ipod cannot be synced error. I then couldn't disconnect the ipod properly and after having loaded about 1gb of music

  • Ipod calibration off

    i just bought the need for speed app and to turn you obviously have to tilt the ipod. When i hold the ipod straight the car still turns. I thought it was just me but i have the igun app also and with it you have this red dot that shows you where your

  • Ios7 crash on Music

    IOS7 Crashed everytime on Ipad4 16GB WiFi when I choose Artists then a song from a particular artist it will crash. I have 2 album and a total of 3 songs under this artist. When I select under song list then it will play fine. I have no problem with