< prev index next >
src/java.desktop/share/classes/sun/swing/SwingUtilities2.java
Print this page
*** 2195,2204 ****
--- 2195,2233 ----
return UIManager.getBoolean(key);
}
/**
+ *
+ * Returns the graphics configuration which bounds contain the given
+ * point
+ *
+ * @param current the default configuration which is checked in the first place
+ * @param x the x coordinate of the given point
+ * @param y the y coordinate of the given point
+ * @return the graphics configuration
+ */
+ public static GraphicsConfiguration getGraphicsConfigurationAtPoint(GraphicsConfiguration current, double x, double y) {
+
+ if (current.getBounds().contains(x, y)) {
+ return current;
+ }
+
+ GraphicsEnvironment env = GraphicsEnvironment.getLocalGraphicsEnvironment();
+ GraphicsDevice[] devices = env.getScreenDevices();
+
+ for (GraphicsDevice device : devices) {
+ GraphicsConfiguration config = device.getDefaultConfiguration();
+ if (config.getBounds().contains(x, y)) {
+ return config;
+ }
+ }
+
+ return current;
+ }
+
+ /**
* Used to listen to "blit" repaints in RepaintManager.
*/
public interface RepaintListener {
void repaintPerformed(JComponent c, int x, int y, int w, int h);
}
< prev index next >