Results 1 to 4 of 4
Thread: Getting mouse coordinates
- 07-20-2009, 05:57 PM #1
Member
- Join Date
- Jul 2009
- Posts
- 10
- Rep Power
- 0
Getting mouse coordinates
I am writing a program wherein I need the coordinates of mouse pointer relative to screen. Using getX() and getY() method we get the x and y coordinates but that is relative to the current frame and to the screen. Is there any other method that returns the coordinates relative to screen? Plz help me
-
Which GUI library are you using?
- 07-20-2009, 06:56 PM #3
Member
- Join Date
- Jul 2009
- Posts
- 10
- Rep Power
- 0
I am using java swing for creating gui.
-
If Swing, are you getting the x and y with a MouseListener or MouseMotionListener? Or with the Toolkit class? If the first two, then the MouseEvent object passed can get you the Point on screen via the getLocationOnScreen() method. Toolkit's MouseInfo object gets location information that is relative to the screen coordinates.
Similar Threads
-
Resizing Coordinates In Applets
By lolmasterzz in forum Java AppletsReplies: 4Last Post: 07-12-2009, 04:17 AM -
button coordinates
By jacline in forum AWT / SwingReplies: 2Last Post: 04-05-2009, 10:58 PM -
Java3D: Clicking and getting coordinates?
By seabhcan in forum Advanced JavaReplies: 0Last Post: 01-11-2008, 02:46 PM -
Object locations via grid coordinates HELP.
By deadman_uk in forum New To JavaReplies: 4Last Post: 11-18-2007, 08:32 PM -
Arc2D.Double coordinates
By alley in forum Java 2DReplies: 2Last Post: 11-07-2007, 10:27 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks