ADDITIONAL SYSTEM INFORMATION :
Windows 10, JDK 11.0.6
WQHD, 125% scaling
A DESCRIPTION OF THE PROBLEM :
Borders of Swing components are sometimed painted too thick with Windows-LAF on HiDPI screens with scaling > 100%. Recently there has been activity in Apache Netbeans to workaound this issue (see https://github.com/apache/netbeans/pull/1777).
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
- Start attached sample application
- Start resizing window
- In most windows sizes some borders of textfields are too thick
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Borders have always the same size
ACTUAL -
Some borders are painted to thick
See screenshots from the sample application: https://imgur.com/YRUdNIz and https://imgur.com/R03Y90h
---------- BEGIN SOURCE ----------
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JTextField;
import javax.swing.SwingUtilities;
import javax.swing.UIManager;
import javax.swing.UnsupportedLookAndFeelException;
import java.awt.FlowLayout;
public class HiDPITest {
private void start() throws ClassNotFoundException, UnsupportedLookAndFeelException, InstantiationException, IllegalAccessException {
UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel");
JFrame frame = new JFrame();
JTextField tf1 = new JTextField();
tf1.setColumns(20);
JTextField tf2 = new JTextField();
tf2.setColumns(20);
JTextField tf3 = new JTextField();
tf3.setColumns(20);
JTextField tf4 = new JTextField();
tf4.setColumns(20);
JPanel p = new JPanel(new FlowLayout());
p.add(tf1);
p.add(tf2);
p.add(tf3);
p.add(tf4);
frame.setContentPane(p);
frame.setSize(200, 200);
frame.setLocationRelativeTo(null);
frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
frame.setVisible(true);
}
public static void main(String[] args) {
SwingUtilities.invokeLater(() -> {
try {
new HiDPITest().start();
} catch (ClassNotFoundException | UnsupportedLookAndFeelException | InstantiationException | IllegalAccessException e) {
e.printStackTrace();
}
});
}
}
---------- END SOURCE ----------
FREQUENCY : always