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

HiDPI: cannot set background color for undecorated JFrame

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Cannot Reproduce
    • Icon: P3 P3
    • 9
    • 9
    • client-libs

      Please run the following example:

      import java.awt.*;
      import java.awt.event.*;
      import javax.swing.*;

      public class Test {

          public static void main(String args[]) {
              try {
                  final int size = 200;
                  SwingUtilities.invokeAndWait(new Runnable() {
                      public void run(){
                          JFrame frame = new JFrame("test");
                          frame.getContentPane().setBackground(Color.red);
                          frame.setSize(size, size);
                          frame.setUndecorated(true);
                          frame.setVisible(true);
                          frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
                      }
                  });
              } catch (Exception e) {
                  System.err.println(e.getMessage());
              }
          }
      }

      expected: reb BG for the frame (checked on Ubuntu 14.04 Linux + JDK9 b93)

      HiDPI + Ubuntu 15.04 + GNOME (3.14.4) + same JDK: BG isn't red (checked both scaling-factors 1 and 2).

            pkbalakr Prem Balakrishnan (Inactive)
            avstepan Alexander Stepanov (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: