Results 1 to 5 of 5

Thread: Robot

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

    Default Robot

    I am using the Robot class to move the mouse. My mouse has 10 buttons, and I would like to simluate the 10th button being clicked, then dragged. Is it possible to use the buttons beyond the first 3?

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

    Default

    I am only familiar ways to get the Robot class to click the first through third mouse buttons, but not any more. My guess is that you'll have to step outside of Java for this such as by using JNI, JNA or linking your Java program with an OS-knowledgeable program such as AutoIt. Question: does your mouse come with its own drivers and programmable buttons? Did it come with any Jar files?

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

    Default

    I am on linux (default drivers), but I will see if there are any jars. Thanks.

  4. #4
    DarrylBurke's Avatar
    DarrylBurke is offline Member
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,196
    Rep Power
    19

    Default

    Since very few people have a 10-button mouse, I'm guessing that portability isn't a concern. You could write a small program with a MouseListener#mousePressed(...) that echoes the int value of MouseEvents#getButton() to the console or a GUI element such as a JLabel (or even add each value to a JList) and observe the value generated when button 10 is pressed. Then use that value in your code.

    Be aware that any change (using a different mouse, updating the mouse driver software ...) may cause your program to break.

    Also note that automated play is banned in most online games.

    db

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

    Default

    Thanks for the reply. At this point, I have no concern about portability. This is not for any online game :)

    I am working on my own vision based gesture system, and in an attempt to avoid re-inventing the wheel, I am using another program, Easystroke. This progam, when mouse button 10 is clicked and dragged, draws on the screen. When finished, It matches to some pre-configured gestures, and performs the action. I am simply trying to transfer control from the mouse to hand via image processing.

    I tried the thing with the mouse event, and Buttons 1-3 returned the button number, e.g. Left click = 1. Every other "extra" button simply returns 0. However, robot takes InputEvent.BUTTON1_MASK, which returns 16. Mouse event is giving the button number, and InputEvent is some other ID.

Similar Threads

  1. Robot
    By PhQ in forum AWT / Swing
    Replies: 13
    Last Post: 08-26-2010, 12:10 AM
  2. Robot class
    By coltragon in forum New To Java
    Replies: 6
    Last Post: 07-12-2010, 05:54 PM
  3. Robot Game
    By yanipao in forum New To Java
    Replies: 1
    Last Post: 03-24-2010, 10:51 AM
  4. Robot Game
    By Galore in forum New To Java
    Replies: 7
    Last Post: 03-21-2010, 06:14 PM
  5. Robot Class
    By jfredrickson in forum New To Java
    Replies: 2
    Last Post: 07-11-2007, 09:00 AM

Posting Permissions

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