Example usage for java.awt GraphicsDevice isWindowTranslucencySupported

List of usage examples for java.awt GraphicsDevice isWindowTranslucencySupported

Introduction

In this page you can find the example usage for java.awt GraphicsDevice isWindowTranslucencySupported.

Prototype

public boolean isWindowTranslucencySupported(WindowTranslucency translucencyKind) 

Source Link

Document

Returns whether the given level of translucency is supported by this graphics device.

Usage

From source file:Test.java

public static void main(String[] args) {
    GraphicsEnvironment envmt = GraphicsEnvironment.getLocalGraphicsEnvironment();
    GraphicsDevice device = envmt.getDefaultScreenDevice();

    if (!device.isWindowTranslucencySupported(WindowTranslucency.PERPIXEL_TRANSLUCENT)) {
        System.out.println("Translucent windows are not supported on your system.");
        System.exit(0);/* ww w.ja va2  s  .  c o  m*/
    }
    JFrame.setDefaultLookAndFeelDecorated(true);
    ApplicationWindow window = new ApplicationWindow();
    window.setVisible(true);
}

From source file:Test.java

License:asdf

public static void main(String[] args) {
    GraphicsEnvironment envmt = GraphicsEnvironment.getLocalGraphicsEnvironment();
    GraphicsDevice device = envmt.getDefaultScreenDevice();

    if (!device.isWindowTranslucencySupported(WindowTranslucency.PERPIXEL_TRANSLUCENT)) {
        System.out.println("Shaped windows are not supported on" + "your system.");
        System.exit(0);/*from ww w .j av  a2  s .c o  m*/
    }

    ApplicationWindow window = new ApplicationWindow();
    window.setVisible(true);
}

From source file:Main.java

public static void main(String[] args) {
    GraphicsEnvironment graphicsEnv = GraphicsEnvironment.getLocalGraphicsEnvironment();

    GraphicsDevice graphicsDevice = graphicsEnv.getDefaultScreenDevice();

    boolean isSupported = graphicsDevice.isWindowTranslucencySupported(PERPIXEL_TRANSPARENT);
    System.out.println("PERPIXEL_TRANSPARENT  supported: " + isSupported);

    isSupported = graphicsDevice.isWindowTranslucencySupported(TRANSLUCENT);
    System.out.println("TRANSLUCENT  supported: " + isSupported);

    isSupported = graphicsDevice.isWindowTranslucencySupported(PERPIXEL_TRANSLUCENT);
    System.out.println("PERPIXEL_TRANSLUCENT  supported: " + isSupported);
}

From source file:Test.java

public static void main(String[] args) {
    JFrame.setDefaultLookAndFeelDecorated(true);

    GraphicsEnvironment graphicsEnvironment = GraphicsEnvironment.getLocalGraphicsEnvironment();
    GraphicsDevice graphicsDevice = graphicsEnvironment.getDefaultScreenDevice();

    if (!graphicsDevice.isWindowTranslucencySupported(GraphicsDevice.WindowTranslucency.TRANSLUCENT)) {
        System.err.println("Translucency is not supported on this platform");
        System.exit(0);//from ww w. ja v a2 s.  c  o m
    }
    ApplicationWindow window = new ApplicationWindow();
    window.setOpacity(0.75f);
    window.setVisible(true);
}

From source file:misc.GradientTranslucentWindowDemo.java

public static void main(String[] args) {
    // Determine what the GraphicsDevice can support.
    GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
    GraphicsDevice gd = ge.getDefaultScreenDevice();
    boolean isPerPixelTranslucencySupported = gd.isWindowTranslucencySupported(PERPIXEL_TRANSLUCENT);

    //If translucent windows aren't supported, exit.
    if (!isPerPixelTranslucencySupported) {
        System.out.println("Per-pixel translucency is not supported");
        System.exit(0);/*from ww w . j  a v a  2s .  c o m*/
    }

    JFrame.setDefaultLookAndFeelDecorated(true);

    // Create the GUI on the event-dispatching thread
    SwingUtilities.invokeLater(new Runnable() {
        @Override
        public void run() {
            GradientTranslucentWindowDemo gtw = new GradientTranslucentWindowDemo();

            // Display the window.
            gtw.setVisible(true);
        }
    });
}

From source file:misc.TranslucentWindowDemo.java

public static void main(String[] args) {
    // Determine if the GraphicsDevice supports translucency.
    GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
    GraphicsDevice gd = ge.getDefaultScreenDevice();

    //If translucent windows aren't supported, exit.
    if (!gd.isWindowTranslucencySupported(TRANSLUCENT)) {
        System.err.println("Translucency is not supported");
        System.exit(0);/* w w w .  j ava2s. c o m*/
    }

    JFrame.setDefaultLookAndFeelDecorated(true);

    // Create the GUI on the event-dispatching thread
    SwingUtilities.invokeLater(new Runnable() {
        @Override
        public void run() {
            TranslucentWindowDemo tw = new TranslucentWindowDemo();

            // Set the window to 55% opaque (45% translucent).
            tw.setOpacity(0.55f);

            // Display the window.
            tw.setVisible(true);
        }
    });
}

From source file:misc.ShapedWindowDemo.java

public static void main(String[] args) {
    // Determine what the GraphicsDevice can support.
    GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
    GraphicsDevice gd = ge.getDefaultScreenDevice();
    final boolean isTranslucencySupported = gd.isWindowTranslucencySupported(TRANSLUCENT);

    //If shaped windows aren't supported, exit.
    if (!gd.isWindowTranslucencySupported(PERPIXEL_TRANSPARENT)) {
        System.err.println("Shaped windows are not supported");
        System.exit(0);/*w w  w.  j a  v  a2  s .c o m*/
    }

    //If translucent windows aren't supported, 
    //create an opaque window.
    if (!isTranslucencySupported) {
        System.out.println("Translucency is not supported, creating an opaque window");
    }

    // Create the GUI on the event-dispatching thread
    SwingUtilities.invokeLater(new Runnable() {
        @Override
        public void run() {
            ShapedWindowDemo sw = new ShapedWindowDemo();

            // Set the window to 70% translucency, if supported.
            if (isTranslucencySupported) {
                sw.setOpacity(0.7f);
            }

            // Display the window.
            sw.setVisible(true);
        }
    });
}

From source file:Main.java

public static boolean isTranslucentSupported() {
    GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
    GraphicsDevice gd = ge.getDefaultScreenDevice();

    boolean isUniformTranslucencySupported = gd
            .isWindowTranslucencySupported(GraphicsDevice.WindowTranslucency.TRANSLUCENT);
    return isUniformTranslucencySupported;
}