src/java.desktop/share/classes/sun/swing/SwingUtilities2.java
changeset 50482 18f8e3b6f3b7
parent 48285 7e8a0c4ee95e
child 50837 86897f8a6598
equal deleted inserted replaced
50481:93879c0753ec 50482:18f8e3b6f3b7
     1 /*
     1 /*
     2  * Copyright (c) 2002, 2015, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 2002, 2018, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     5  * This code is free software; you can redistribute it and/or modify it
     6  * under the terms of the GNU General Public License version 2 only, as
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.  Oracle designates this
     7  * published by the Free Software Foundation.  Oracle designates this
    50 import javax.swing.table.TableCellRenderer;
    50 import javax.swing.table.TableCellRenderer;
    51 import javax.swing.table.TableColumnModel;
    51 import javax.swing.table.TableColumnModel;
    52 import javax.swing.tree.TreeModel;
    52 import javax.swing.tree.TreeModel;
    53 import javax.swing.tree.TreePath;
    53 import javax.swing.tree.TreePath;
    54 
    54 
       
    55 import sun.java2d.pipe.Region;
    55 import sun.print.ProxyPrintGraphics;
    56 import sun.print.ProxyPrintGraphics;
    56 import sun.awt.*;
    57 import sun.awt.*;
    57 import java.io.*;
    58 import java.io.*;
    58 import java.security.AccessController;
    59 import java.security.AccessController;
    59 import java.security.PrivilegedAction;
    60 import java.security.PrivilegedAction;
  2239 
  2240 
  2240         return UIManager.getBoolean(key);
  2241         return UIManager.getBoolean(key);
  2241     }
  2242     }
  2242 
  2243 
  2243     /**
  2244     /**
  2244      *
       
  2245      * Returns the graphics configuration which bounds contain the given
       
  2246      * point
       
  2247      *
       
  2248      * @param current the default configuration which is checked in the first place
       
  2249      * @param x the x coordinate of the given point
       
  2250      * @param y the y coordinate of the given point
       
  2251      * @return the graphics configuration
       
  2252      */
       
  2253     public static GraphicsConfiguration getGraphicsConfigurationAtPoint(GraphicsConfiguration current, double x, double y) {
       
  2254 
       
  2255         if (current.getBounds().contains(x, y)) {
       
  2256             return current;
       
  2257         }
       
  2258 
       
  2259         GraphicsEnvironment env = GraphicsEnvironment.getLocalGraphicsEnvironment();
       
  2260         GraphicsDevice[] devices = env.getScreenDevices();
       
  2261 
       
  2262         for (GraphicsDevice device : devices) {
       
  2263             GraphicsConfiguration config = device.getDefaultConfiguration();
       
  2264             if (config.getBounds().contains(x, y)) {
       
  2265                 return config;
       
  2266             }
       
  2267         }
       
  2268 
       
  2269         return current;
       
  2270     }
       
  2271 
       
  2272     /**
       
  2273      * Used to listen to "blit" repaints in RepaintManager.
  2245      * Used to listen to "blit" repaints in RepaintManager.
  2274      */
  2246      */
  2275     public interface RepaintListener {
  2247     public interface RepaintListener {
  2276         void repaintPerformed(JComponent c, int x, int y, int w, int h);
  2248         void repaintPerformed(JComponent c, int x, int y, int w, int h);
  2277     }
  2249     }