2 Replies Latest reply on Jul 28, 2011 6:07 PM by 878433

    Cant't draw picture with alpha on tranlucent window

      I cant draw picture with alpha on my translucent window, it only looks fine when everything behind window is completely black.
      I have been trying with png, jpg, and gif, and only gif works fine.
      Here's picture that I used:
      import java.awt.Frame;
      import java.awt.Graphics;
      import java.awt.event.WindowAdapter;
      import java.awt.event.WindowEvent;
      import java.awt.image.BufferedImage;
      import java.io.File;
      import javax.imageio.ImageIO;
      import com.sun.awt.AWTUtilities;
      import com.sun.jna.platform.WindowUtils;
      public class TranslucentWindowPicture {
           public static void main(String[] args) {
                Frame frame = new Frame(WindowUtils.getAlphaCompatibleGraphicsConfiguration());
                AWTUtilities.setWindowOpaque(frame, false);
                frame.addWindowListener(new WindowAdapter() {
                     public void windowClosing(WindowEvent e) {
                BufferedImage image;
                try {
                     image = ImageIO.read(new File("path/to/file"));
                } catch (Exception e) {
                     image = null;
                Graphics g = frame.getGraphics();
                g.drawImage(image, 0, 0, frame);
      Thank you in advance.