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. package java.awt;
  8. /**
  9. * A class that describes the pointer position.
  10. * It provides the <code>GraphicsDevice</code> where the
  11. * pointer is and the <code>Point</code> that represents
  12. * the coordinates of the pointer.
  13. * <p>
  14. * Instances of this class should be obtained via
  15. * {@link MouseInfo#getPointerInfo}.
  16. * The <code>PointerInfo</code> instance is not updated dynamically
  17. * as the mouse moves. To get the updated location, you must call
  18. * {@link MouseInfo#getPointerInfo} again.
  19. *
  20. * @see MouseInfo#getPointerInfo
  21. * @version 1.2, 12/19/03
  22. * @author Roman Poborchiy
  23. * @since 1.5
  24. */
  25. public class PointerInfo {
  26. private GraphicsDevice device;
  27. private Point location;
  28. /**
  29. * Package-private constructor to prevent instantiation.
  30. */
  31. PointerInfo(GraphicsDevice device, Point location) {
  32. this.device = device;
  33. this.location = location;
  34. }
  35. /**
  36. * Returns the <code>GraphicsDevice</code> where the mouse pointer
  37. * was at the moment this <code>PointerInfo</code> was created.
  38. *
  39. * @return <code>GraphicsDevice</code> corresponding to the pointer
  40. * @since 1.5
  41. */
  42. public GraphicsDevice getDevice() {
  43. return device;
  44. }
  45. /**
  46. * Returns the <code>Point</code> that represents the coordinates
  47. * of the pointer on the screen. See {@link MouseInfo#getPointerInfo}
  48. * for more information about coordinate calculation for multiscreen
  49. * systems.
  50. *
  51. * @see MouseInfo
  52. * @see MouseInfo#getPointerInfo
  53. * @return coordinates of mouse pointer
  54. * @since 1.5
  55. */
  56. public Point getLocation() {
  57. return location;
  58. }
  59. }