Results 1 to 2 of 2
  1. #1
    0circle0 is offline Member
    Join Date
    Jul 2011
    Posts
    18
    Rep Power
    0

    Question Mouse position in applet window not screen

    MouseInfo.getPointerInfo().getLocation().x
    returns the location of the mouse on the screen; however I have been trying to find out how to just return the location relative to the applet no matter where its location on the screen is. How would I do that?

  2. #2
    0circle0 is offline Member
    Join Date
    Jul 2011
    Posts
    18
    Rep Power
    0

    Default

    Found that if you take MouseInfo.getPointerInfo().getLocation().x - this.getLocationOnScreen().x you get the relative location. Guess I wasn't forming my question correctly in Google. Similar threads found it for me.

Similar Threads

  1. Repositioning components based on mouse position
    By robbie.26 in forum AWT / Swing
    Replies: 3
    Last Post: 06-21-2011, 06:55 AM
  2. Java Applet: drawing window bigger than screen
    By srbehera in forum Java Applets
    Replies: 2
    Last Post: 04-18-2011, 04:48 AM
  3. Problem with determing mouse position!!!
    By G.rocks in forum New To Java
    Replies: 6
    Last Post: 07-15-2010, 05:09 PM
  4. Replies: 0
    Last Post: 06-25-2008, 10:32 AM
  5. Use the mouse position
    By susan in forum Java Applets
    Replies: 1
    Last Post: 07-28-2007, 11:10 PM

Posting Permissions

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