< prev index next >

src/java.desktop/share/classes/sun/swing/SwingUtilities2.java

Print this page




2180     /**
2181      * Returns the client property for the given key if it is set; otherwise
2182      * returns the {@L&F} property.
2183      *
2184      * @param component the component
2185      * @param key an {@code String} specifying the key for the desired boolean value
2186      * @return the boolean value of the client property if it is set or the {@L&F}
2187      *         property in other case.
2188      */
2189     public static boolean getBoolean(JComponent component, String key) {
2190         Object clientProperty = component.getClientProperty(key);
2191 
2192         if (clientProperty instanceof Boolean) {
2193             return Boolean.TRUE.equals(clientProperty);
2194         }
2195 
2196         return UIManager.getBoolean(key);
2197     }
2198 
2199     /**





























2200      * Used to listen to "blit" repaints in RepaintManager.
2201      */
2202     public interface RepaintListener {
2203         void repaintPerformed(JComponent c, int x, int y, int w, int h);
2204     }
2205 }


2180     /**
2181      * Returns the client property for the given key if it is set; otherwise
2182      * returns the {@L&F} property.
2183      *
2184      * @param component the component
2185      * @param key an {@code String} specifying the key for the desired boolean value
2186      * @return the boolean value of the client property if it is set or the {@L&F}
2187      *         property in other case.
2188      */
2189     public static boolean getBoolean(JComponent component, String key) {
2190         Object clientProperty = component.getClientProperty(key);
2191 
2192         if (clientProperty instanceof Boolean) {
2193             return Boolean.TRUE.equals(clientProperty);
2194         }
2195 
2196         return UIManager.getBoolean(key);
2197     }
2198 
2199     /**
2200      *
2201      * Returns the graphics configuration which bounds contain the given
2202      * point
2203      *
2204      * @param current the default configuration which is checked in the first place
2205      * @param x the x coordinate of the given point
2206      * @param y the y coordinate of the given point
2207      * @return the graphics configuration
2208      */
2209     public static GraphicsConfiguration getGraphicsConfigurationAtPoint(GraphicsConfiguration current, double x, double y) {
2210 
2211         if (current.getBounds().contains(x, y)) {
2212             return current;
2213         }
2214 
2215         GraphicsEnvironment env = GraphicsEnvironment.getLocalGraphicsEnvironment();
2216         GraphicsDevice[] devices = env.getScreenDevices();
2217 
2218         for (GraphicsDevice device : devices) {
2219             GraphicsConfiguration config = device.getDefaultConfiguration();
2220             if (config.getBounds().contains(x, y)) {
2221                 return config;
2222             }
2223         }
2224 
2225         return current;
2226     }
2227 
2228     /**
2229      * Used to listen to "blit" repaints in RepaintManager.
2230      */
2231     public interface RepaintListener {
2232         void repaintPerformed(JComponent c, int x, int y, int w, int h);
2233     }
2234 }
< prev index next >