![]() |
The Java Developers Almanac 1.4Order this book from Amazon. |
e865. Converting Between Component and Screen CoordinatesThis example demonstrates how to convert a coordinate within a component to a coordinate on the screen and visa versa.// Convert a coordinate relative to a component's bounds to screen coordinates Point pt = new Point(component.getLocation()); SwingUtilities.convertPointToScreen(pt, component); // Convert a coordinate on a screen to a coordinate relative to a component's bounds SwingUtilities.convertPointFromScreen(pt, component);
© 2002 Addison-Wesley. |