Java Code Examples for javax.swing.JWindow#getGraphicsConfiguration()

The following examples show how to use javax.swing.JWindow#getGraphicsConfiguration() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CustomPopupFactory.java    From netbeans with Apache License 2.0 5 votes vote down vote up
private static void safeSetBackground(JWindow window, Color background) {
    GraphicsConfiguration gc = window.getGraphicsConfiguration();
    
    if (!gc.isTranslucencyCapable()) return; // PERPIXEL_TRANSLUCENT not supported
    if (gc.getDevice().getFullScreenWindow() == window) return; // fullscreen windows not supported
    
    window.setBackground(background);
}
 
Example 2
Source File: ProfilerTableHovers.java    From netbeans with Apache License 2.0 5 votes vote down vote up
private static void safeSetBackground(JWindow window, Color background) {
    GraphicsConfiguration gc = window.getGraphicsConfiguration();
    
    if (!gc.isTranslucencyCapable()) return; // PERPIXEL_TRANSLUCENT not supported
    if (gc.getDevice().getFullScreenWindow() == window) return; // fullscreen windows not supported
    
    window.setBackground(background);
}
 
Example 3
Source File: ProfilerTableHovers.java    From visualvm with GNU General Public License v2.0 5 votes vote down vote up
private static void safeSetBackground(JWindow window, Color background) {
        GraphicsConfiguration gc = window.getGraphicsConfiguration();
        
//        if (!gc.isTranslucencyCapable()) return; // PERPIXEL_TRANSLUCENT not supported // doesn't work well with Ubuntu@VirtualBox, handled in catch below
        if (gc.getDevice().getFullScreenWindow() == window) return; // fullscreen windows not supported
        
        // PERPIXEL_TRANSLUCENT not supported, safely ignore
        try { window.setBackground(background); }
        catch (UnsupportedOperationException e) {}
    }