Results 1 to 6 of 6
  1. #1
    nest17 is offline Member
    Join Date
    Feb 2011
    Posts
    2
    Rep Power
    0

    Default external mouse actions

    I'm interested in determining where a mouse is clicked and how much time has passed since the last click. However, I don't want to be restrained to a component's size and location. I'd like this to a sort of "background" operation, so I can continue clicking as normal in my other applications, while being able to see what I'm doing.
    Any suggestions would be a great help.
    Thanks.

  2. #2
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    25

    Default

    Suggestion 1: don't use Java for this. To do this, you'll likely need to hook the OS's mouse routines, and Java, being relatively OS agnostic, is not a good language for close interactions with the OS.

  3. #3
    nest17 is offline Member
    Join Date
    Feb 2011
    Posts
    2
    Rep Power
    0

    Default

    Okay... I just thought it'd be possible, since MouseInfo already tracks the mouse's location. I figured it'd be a short step away from clicking.
    Also, you say "suggestion 1:" as if there is a second suggestion?

  4. #4
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    25

    Default

    Quote Originally Posted by nest17 View Post
    Okay... I just thought it'd be possible, since MouseInfo already tracks the mouse's location. I figured it'd be a short step away from clicking.
    Also, you say "suggestion 1:" as if there is a second suggestion?
    Yep, it's see suggestion 1. ;)

  5. #5
    rp181 is offline Member
    Join Date
    Mar 2009
    Posts
    70
    Rep Power
    0

    Default

    What I have done when i needed hardware in Java is write a simple C++ program, relaying whatever information through a socket to Java. Sockets are low level, so it should work on any system. It is hackish, but it works.

  6. #6
    toadaly is offline Senior Member
    Join Date
    Jan 2009
    Posts
    671
    Rep Power
    6

    Default

    Quote Originally Posted by nest17 View Post
    I'm interested in determining where a mouse is clicked and how much time has passed since the last click. However, I don't want to be restrained to a component's size and location. I'd like this to a sort of "background" operation, so I can continue clicking as normal in my other applications, while being able to see what I'm doing.
    Any suggestions would be a great help.
    Thanks.
    As long as the actions are related to your application, you can use java.awt.Toolkit.addAWTEventListener to listen for all events of interest related to your application. This is better than polling mouseinfo, which could miss events during wait cycles.

Similar Threads

  1. Actions
    By What2do in forum New To Java
    Replies: 4
    Last Post: 01-31-2011, 04:45 PM
  2. How to Use Actions
    By AJArmstron@aol.com in forum New To Java
    Replies: 4
    Last Post: 04-18-2010, 09:03 PM
  3. JMenuItems and actions
    By Kligham in forum New To Java
    Replies: 5
    Last Post: 01-05-2010, 05:00 PM
  4. Mouse Listener for mouse floating over object?
    By Krooger in forum AWT / Swing
    Replies: 1
    Last Post: 11-18-2009, 04:34 AM
  5. Actions
    By alley in forum AWT / Swing
    Replies: 2
    Last Post: 01-16-2008, 02:52 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •