2009 * component.
2010 * </p>
2011 * @return an instance of <code>Point</code> representing
2012 * the top-left corner of the component's bounds in
2013 * the coordinate space of the component's parent
2014 * @see #setLocation
2015 * @see #getLocationOnScreen
2016 * @since JDK1.1
2017 */
2018 public Point getLocation() {
2019 return location();
2020 }
2021
2022 /**
2023 * Gets the location of this component in the form of a point
2024 * specifying the component's top-left corner in the screen's
2025 * coordinate space.
2026 * @return an instance of <code>Point</code> representing
2027 * the top-left corner of the component's bounds in the
2028 * coordinate space of the screen
2029 * @throws <code>IllegalComponentStateException</code> if the
2030 * component is not showing on the screen
2031 * @see #setLocation
2032 * @see #getLocation
2033 */
2034 public Point getLocationOnScreen() {
2035 synchronized (getTreeLock()) {
2036 return getLocationOnScreen_NoTreeLock();
2037 }
2038 }
2039
2040 /*
2041 * a package private version of getLocationOnScreen
2042 * used by GlobalCursormanager to update cursor
2043 */
2044 final Point getLocationOnScreen_NoTreeLock() {
2045
2046 if (peer != null && isShowing()) {
2047 if (peer instanceof LightweightPeer) {
2048 // lightweight component location needs to be translated
2049 // relative to a native component.
|
2009 * component.
2010 * </p>
2011 * @return an instance of <code>Point</code> representing
2012 * the top-left corner of the component's bounds in
2013 * the coordinate space of the component's parent
2014 * @see #setLocation
2015 * @see #getLocationOnScreen
2016 * @since JDK1.1
2017 */
2018 public Point getLocation() {
2019 return location();
2020 }
2021
2022 /**
2023 * Gets the location of this component in the form of a point
2024 * specifying the component's top-left corner in the screen's
2025 * coordinate space.
2026 * @return an instance of <code>Point</code> representing
2027 * the top-left corner of the component's bounds in the
2028 * coordinate space of the screen
2029 * @throws IllegalComponentStateException if the
2030 * component is not showing on the screen
2031 * @see #setLocation
2032 * @see #getLocation
2033 */
2034 public Point getLocationOnScreen() {
2035 synchronized (getTreeLock()) {
2036 return getLocationOnScreen_NoTreeLock();
2037 }
2038 }
2039
2040 /*
2041 * a package private version of getLocationOnScreen
2042 * used by GlobalCursormanager to update cursor
2043 */
2044 final Point getLocationOnScreen_NoTreeLock() {
2045
2046 if (peer != null && isShowing()) {
2047 if (peer instanceof LightweightPeer) {
2048 // lightweight component location needs to be translated
2049 // relative to a native component.
|