Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8029189

Undecorated frame with transparent background does not show its content

XMLWordPrintable

    • 2d
    • linux_ubuntu

      import java.awt.Color;
      import java.awt.Frame;
      import java.awt.Label;
      import static java.awt.EventQueue.invokeAndWait;

      public class AWT {
          public static void main(String[] args) throws Exception {
              invokeAndWait(() -> {
                  Frame frame = new Frame();
                  frame.add(new Label("TEST"));
                  frame.setUndecorated(true);
                  frame.setBackground(new Color(0f, 1f, 0f, 0.5f));
                  frame.setBounds(200, 200, 200, 200);
                  frame.setVisible(true);
              });
          }
      }

      The code above shows a label with the following cmd:
      java -Dsun.java2d.xrender=false AWT

      The code above does not show a label with the following cmd:
      java -Dsun.java2d.xrender=true AWT

            prr Philip Race
            malenkov Sergey Malenkov (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            8 Start watching this issue

              Created:
              Updated:
              Resolved: