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 2 of 2

Thread: Java Robot Questions

  1. #1
    Member
    Join Date
    Jan 2011
    Posts
    88
    Thanks
    6
    Thanked 0 Times in 0 Posts

    Default Java Robot Questions

    So I am working on creating a bot to automate a process for me, I don't have any problem moving the mouse around and clicking stuff. However, I only want the mouse to be able to move inside of a JPanel. How would this be possible?


  2. #2
    Member
    Join Date
    Jul 2012
    Posts
    83
    My Mood
    Cynical
    Thanks
    3
    Thanked 9 Times in 9 Posts

    Default Re: Java Robot Questions

    If you only want to move the mouse programmatically within a restricted rectangle, then tell us where you're stuck in this process.

    If you want to prevent the user from moving the mouse outside of a defined rectangle, then for this you would require either JNI or JNA to make platform calls. Of necessity any solution would be platform-specific. On a side note, I would not want to be a user of your program to find that my mouse has been restricted to a box.

    Also, if you need to find the dimensions of the outside application, then (I believe) you would need to again make platform/OS calls, and again this may require use of JNI or JNA (or some outside library, such as AutoIt if this is Windows).
    Last edited by Fubarable; July 4th, 2012 at 03:50 PM.

Similar Threads

  1. Need an alternative to java.awt.Robot
    By Contrary in forum Java Theory & Questions
    Replies: 11
    Last Post: March 24th, 2012, 09:19 AM
  2. Help in java questions
    By Normal9ja in forum Java Theory & Questions
    Replies: 3
    Last Post: September 21st, 2011, 08:42 PM
  3. 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, 12:13 AM
  4. Java Questions! :)
    By xs4rdx in forum Java Theory & Questions
    Replies: 0
    Last Post: February 21st, 2010, 08:40 AM
  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 24th, 2009, 11:40 PM

Tags for this Thread