Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 12 of 12

Thread: Need an alternative to java.awt.Robot

  1. #1
    Junior Member
    Join Date
    Mar 2012
    Posts
    6
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default Need an alternative to java.awt.Robot

    I need an alternative to java.awt.Robot (or a way to use it) that doesn't move you're actual mouse pointer, but will move a fake/Virtual mouse, any suggestions?

    If it makes any difference, I need this to work in an applet that is running in a jframe and I need it to be able to left and right click exact points as well as move (just like the robot class, just without disturbing you're actual mouse).


  2. #2
    Forum Squatter newbie's Avatar
    Join Date
    Nov 2010
    Location
    North Wales
    Posts
    661
    My Mood
    Stressed
    Thanks
    28
    Thanked 115 Times in 106 Posts
    Blog Entries
    1

    Default Re: Need an alternative to java.awt.Robot

    First off, is there a specific reason you don't want your mouse to be affected?
    Please use [highlight=Java]//code goes here...[/highlight] tags when posting your code

  3. #3
    Junior Member
    Join Date
    Mar 2012
    Posts
    6
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default Re: Need an alternative to java.awt.Robot

    Quote Originally Posted by newbie View Post
    First off, is there a specific reason you don't want your mouse to be affected?
    Yes, I'm currently working on a maco that will work within an applet loaded into a jframe, and to allow multiple macros to be run at once, i would need to have some sort of a virtual mouse as opposed to the real mouse cursor.

  4. #4
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    22,346
    Thanks
    56
    Thanked 2,376 Times in 2,346 Posts

    Default Re: Need an alternative to java.awt.Robot

    What type of mouse events do you want your virtual mouse to do?
    In some cases it is possible to create different types of mouse events and cause them to be sent to components' mouse listeners.
    If you don't understand my answer, don't ignore it, ask a question.

  5. #5
    Junior Member
    Join Date
    Mar 2012
    Posts
    6
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default Re: Need an alternative to java.awt.Robot

    Quote Originally Posted by Norm View Post
    What type of mouse events do you want your virtual mouse to do?
    In some cases it is possible to create different types of mouse events and cause them to be sent to components' mouse listeners.
    Well, I'll need it to move (If possible, move across the screen, not just instantly) and be able to Left and right click.

  6. #6
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    22,346
    Thanks
    56
    Thanked 2,376 Times in 2,346 Posts

    Default Re: Need an alternative to java.awt.Robot

    Does that mean it is visual?
    If you don't understand my answer, don't ignore it, ask a question.

  7. #7
    Junior Member
    Join Date
    Mar 2012
    Posts
    6
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default Re: Need an alternative to java.awt.Robot

    Quote Originally Posted by Norm View Post
    Does that mean it is visual?
    Yes it's visual.

  8. #8
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    22,346
    Thanks
    56
    Thanked 2,376 Times in 2,346 Posts

    Default Re: Need an alternative to java.awt.Robot

    I think that part could be a frameless, transparent window showing a cursor image.
    If you don't understand my answer, don't ignore it, ask a question.

  9. The Following User Says Thank You to Norm For This Useful Post:

    Contrary (March 23rd, 2012)

  10. #9
    Junior Member
    Join Date
    Mar 2012
    Posts
    6
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default Re: Need an alternative to java.awt.Robot

    Quote Originally Posted by Norm View Post
    I think that part could be a frameless, transparent window showing a cursor image.
    Actually that's a great idea for the visual aspect, thanks! But do you have any ideas on the actual programming of it?

  11. #10
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    22,346
    Thanks
    56
    Thanked 2,376 Times in 2,346 Posts

    Default Re: Need an alternative to java.awt.Robot

    Not any more than I have already mentioned.
    If you don't understand my answer, don't ignore it, ask a question.

  12. #11
    Junior Member
    Join Date
    Mar 2012
    Posts
    6
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default Re: Need an alternative to java.awt.Robot

    Quote Originally Posted by Norm View Post
    Not any more than I have already mentioned.
    Oh, well thanks for you're previous input.

  13. #12
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    22,346
    Thanks
    56
    Thanked 2,376 Times in 2,346 Posts

    Default Re: Need an alternative to java.awt.Robot

    More on passing mouse events to a component.
    If you get the mouselisteners for a component (there is a method that does that) you can call any of its mouse listening methods with MouseEvent objects.
    If you don't understand my answer, don't ignore it, ask a question.

Similar Threads

  1. alternative to JMF
    By olimpicco in forum Java Theory & Questions
    Replies: 0
    Last Post: December 19th, 2011, 09:50 PM
  2. How to Sendkeys to an application in Java using the Robot Class
    By JavaPF in forum Java SE API Tutorials
    Replies: 6
    Last Post: August 4th, 2011, 01:13 AM
  3. Alternative to the scanner method
    By Harrisk9 in forum Java SE APIs
    Replies: 2
    Last Post: November 28th, 2009, 10:30 PM
  4. JNI Alternative?
    By janusmccarthy in forum Java Native Interface
    Replies: 1
    Last Post: November 14th, 2009, 12:22 PM
  5. How to Sendkeys to an application in Java using the Robot Class
    By JavaPF in forum Java Code Snippets and Tutorials
    Replies: 4
    Last Post: October 25th, 2009, 12:40 AM