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

Artifacts of moving opaque JInternalFrame in JDesktopPane on Windows 125% scale| Adopt OpenJDK 15.0.1

XMLWordPrintable

      ADDITIONAL SYSTEM INFORMATION :
      Windows 10, AdoptOpenJDK 15.0.1.9-hotspot

      A DESCRIPTION OF THE PROBLEM :
      We use internalFrame.setOpaque(true); and lnf without transparent shadows to speedup JDesktopPane redraw with many internal frames. When Windows scale is set to 125%, when we move or resize the internal frame, the artefacts are sometimes leaved uncleared: lines or dots from the right and bottom border of the frame. This happens always (on every app launch), but to see it someone need to move/resize the internal frame for some time to get luck. It seems that JDesktopPane does not clear/redraw one pixel on the right/bottom border due to some rounding effect with 125% scale. Tested with Windows (system) look and feel and also with FlatLaf.
      Maybe it is related to https://bugs.openjdk.java.net/browse/JDK-8253530


      ---------- BEGIN SOURCE ----------
      package desktoppanebug;

      import java.awt.Color;
      import java.util.logging.Level;
      import java.util.logging.Logger;
      import javax.swing.JDesktopPane;
      import javax.swing.JFrame;
      import javax.swing.JInternalFrame;
      import javax.swing.UIManager;

      public class DesktopPaneBug {
          public static void main(String[] args) {
              try {
                  UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
              } catch (Exception ex) {
                  ex.printStackTrace();
              }

              JDesktopPane desktopPane = new JDesktopPane();
              desktopPane.setBackground(Color.WHITE);

              JInternalFrame frame = new JInternalFrame("InternalFrame");
              frame.setOpaque(true); // This is the main cause

              frame.setLocation(10, 10);
              frame.setSize(200, 100);
              frame.setResizable(true);
              frame.setVisible(true);

              desktopPane.add(frame);

              JFrame mainFrame = new JFrame("JInternalFrame 125% scale bug");
              mainFrame.getContentPane().add(desktopPane);
              mainFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
              mainFrame.setSize(800, 500);
              mainFrame.setVisible(true);
          }
      }

      ---------- END SOURCE ----------

      FREQUENCY : always


        1. DesktopPaneBug.java
          1 kB
          Praveen Narayanaswamy

            pnarayanaswa Praveen Narayanaswamy
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: