KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > java > awt > PointerInfo


1 /*
2  * @(#)PointerInfo.java 1.2 03/12/19
3  *
4  * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
5  * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
6  */

7
8 package java.awt;
9
10 /**
11  * A class that describes the pointer position.
12  * It provides the <code>GraphicsDevice</code> where the
13  * pointer is and the <code>Point</code> that represents
14  * the coordinates of the pointer.
15  * <p>
16  * Instances of this class should be obtained via
17  * {@link MouseInfo#getPointerInfo}.
18  * The <code>PointerInfo</code> instance is not updated dynamically
19  * as the mouse moves. To get the updated location, you must call
20  * {@link MouseInfo#getPointerInfo} again.
21  *
22  * @see MouseInfo#getPointerInfo
23  * @version 1.2, 12/19/03
24  * @author Roman Poborchiy
25  * @since 1.5
26  */

27
28 public class PointerInfo {
29
30     private GraphicsDevice JavaDoc device;
31     private Point JavaDoc location;
32
33     /**
34      * Package-private constructor to prevent instantiation.
35      */

36     PointerInfo(GraphicsDevice JavaDoc device, Point JavaDoc location) {
37         this.device = device;
38         this.location = location;
39     }
40
41     /**
42      * Returns the <code>GraphicsDevice</code> where the mouse pointer
43      * was at the moment this <code>PointerInfo</code> was created.
44      *
45      * @return <code>GraphicsDevice</code> corresponding to the pointer
46      * @since 1.5
47      */

48     public GraphicsDevice JavaDoc getDevice() {
49         return device;
50     }
51
52     /**
53      * Returns the <code>Point</code> that represents the coordinates
54      * of the pointer on the screen. See {@link MouseInfo#getPointerInfo}
55      * for more information about coordinate calculation for multiscreen
56      * systems.
57      *
58      * @see MouseInfo
59      * @see MouseInfo#getPointerInfo
60      * @return coordinates of mouse pointer
61      * @since 1.5
62      */

63     public Point JavaDoc getLocation() {
64         return location;
65     }
66
67 }
68
Popular Tags