JDK-8279614 : The left line of the TitledBorder is not painted on 150 scale factor
  • Type: Bug
  • Component: client-libs
  • Sub-Component: java.awt
  • Affected Version: 11,17,18,19
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • OS: windows
  • CPU: x86_64
  • Submitted: 2022-01-06
  • Updated: 2022-11-09
  • Resolved: 2022-06-13
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 11 JDK 17 JDK 20
11.0.19-oracleFixed 17.0.7-oracleFixed 20 b02Fixed
Related Reports
Relates :  
Relates :  
Relates :  
Relates :  
Relates :  
Description
ADDITIONAL SYSTEM INFORMATION :
Windows, jdk-19 and jdk-17

A DESCRIPTION OF THE PROBLEM :
When I run the code attached into the "Source code for an executable test case" section, the line from the left side of the TitledBorder is not painted correctly. This is painted in white instead of black/grey.

I reproduced the problem on Windows with a HiDPI monitor and a scaling factor set to 150. 
The border is painted well when the scaling factor is set to 100 or 125.

REGRESSION : Last worked in version 8u301

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Prerequisite: an HiDPI monitor
Execute the attached code on Windows 10 with a scaling factor set to 150.


EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
The line from the left side of the title border will be painted as the one from the right side.
ACTUAL -
The line from the left side is painted in white.

---------- BEGIN SOURCE ----------
package ro.sync.ui.application;
import java.awt.BorderLayout;

import javax.swing.BorderFactory;
import javax.swing.JCheckBox;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.UIManager;

import ro.sync.ui.LFSystemUtil;

public class SwingDemo2 {

  public static void main(String[] args) throws Exception {
    UIManager.setLookAndFeel(LFSystemUtil.getSystemLookAndFeelClassName());

    JFrame frame = new JFrame("Swing Test");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    JPanel parentPanel = new JPanel(new BorderLayout());
    parentPanel.setBorder(ApplicationBorderFactory.createEmptyBorder(5, 5, 5, 5));

    JPanel childPanel = new JPanel(new BorderLayout());
    childPanel.setBorder(BorderFactory.createTitledBorder("Title"));
    childPanel.add(new JCheckBox(), BorderLayout.CENTER);

    parentPanel.add(childPanel, BorderLayout.CENTER);

    frame.getContentPane().add(parentPanel, BorderLayout.CENTER);    

    frame.pack();
    frame.setLocationRelativeTo(null);  
    frame.setVisible(true);
  }
}
---------- END SOURCE ----------

CUSTOMER SUBMITTED WORKAROUND :
I don't have a workaround

FREQUENCY : always



Comments
Changeset: b42c1ad1 Author: Alisen Chung <achung@openjdk.org> Committer: Alexey Ivanov <aivanov@openjdk.org> Date: 2022-06-13 20:05:06 +0000 URL: https://git.openjdk.org/jdk/commit/b42c1ad1086a5c3f579e27380d23f67f8cebb437
13-06-2022

Looks like the shadowed part of the border is not showing up when set to 150% scaling, but the highlighted part of the border is. Removing the highlighted part of the border causes the shadowed part of the border to reappear. Seems like the issue is the highlighted part of the border is overdrawing the shadowed part of the border. Since the darker line is seen as the "actual" border, reordering the painting of the lines so that the darker line is always drawn second would solve this issue.
08-03-2022

A pull request was submitted for review. URL: https://git.openjdk.java.net/jdk/pull/7449 Date: 2022-02-11 23:44:22 +0000
14-02-2022

Checked with attached test case in Window 10, Display resolution 1920*1080 and Scale at 150%, issue is reproducible(attached screenshot) Test Case: ======== 8u311: Pass 11: Fail 11.0.13: Fail 17: Fail 18ea29: Fail 19ea4: Fail
07-01-2022