September 04, 2010, 04:02:36 AM *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
  Home Help Media Affiliates Login Register  
Pages: [1]   Go Down
  Print  
Author Topic: [How to] get the Mouse Position  (Read 794 times)
0 Members and 1 Guest are viewing this topic.
G. Ritardo
Member
*
*

Reputation: 0
Offline Offline
Posts: 53
Referrals: 0

Awards
« on: April 30, 2009, 09:29:37 AM »

You can get the x,y position of your mouse by using the code below.

Code
GeSHi (java):
  1. import java.awt.MouseInfo;
  2.  
  3. public class Mouse {
  4. public static void main(String[] args) throws InterruptedException{
  5. while(true){
  6. Thread.sleep(100);
  7. System.out.println("("+MouseInfo.getPointerInfo().getLocation().x+", "+MouseInfo.getPointerInfo().getLocation().y+")");
  8. }
  9. }
  10. }
Created by GeSHI 1.0.7.20
Logged
My Contributions

Onzin > Email address of gaylords


Founder of www.Retardation-Foundation.com :: A community for retarded people!? Powered by admin Gaylord Ritardo.
Javaforums.net :: a community about Java software development.
« on: April 30, 2009, 09:29:37 AM »

Your Ad Here
 Logged
Pages: [1]   Go Up
  Print  
 
Jump to:  

Your Ad Here
Powered by MySQL Powered by PHP Powered by SMF 1.1.10 | SMF © 2006-2009, Simple Machines LLC
TinyPortal v0.9.8 © Bloc
Valid XHTML 1.0! Valid CSS!
Page created in 0.139 seconds with 33 queries.

Google visited last this page Yesterday at 11:36:56 AM