-
Bug
-
Resolution: Fixed
-
P4
-
11, 17, 21
-
b10
-
generic
-
generic
ADDITIONAL SYSTEM INFORMATION :
java version 11 and above.
Windows 10, 225% screen scale
A DESCRIPTION OF THE PROBLEM :
There is a miss-match between painting of JTable header border and its data grid border. The issue occurs in Metal Look and Feel only. This can be observed when when scaling factor is increased and hence in the example 225% scaling factor is chosen.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Set screen scale on Windows to 225% .
Run code.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
The Table header border should be aligned with data grid vertical lines
ACTUAL -
The Table header border is not aligned with data grid vertical lines
---------- BEGIN SOURCE ----------
import javax.swing.JFrame;
import javax.swing.JScrollPane;
import javax.swing.JTable;
import javax.swing.UIManager;
import javax.swing.UnsupportedLookAndFeelException;
public class TableSample {
JFrame f;
JTable j;
TableSample()
{
f = new JFrame();
f.setTitle("JTable - 225% scaling");
String[][] data = {
{ "Java", "Java", "Java"},
{ "Java", "Java", "Java"}
};
String[] columnNames = { "Size", "Size", "Size"};
j = new JTable(data, columnNames);
j.setBounds(30, 40, 200, 300);
JScrollPane sp = new JScrollPane(j);
f.add(sp);
f.setSize(500, 200);
f.setVisible(true);
}
public static void main(String[] args) throws UnsupportedLookAndFeelException, ClassNotFoundException, InstantiationException, IllegalAccessException {
System.setProperty("sun.java2d.uiScale", "2.25");
UIManager.setLookAndFeel("javax.swing.plaf.metal.MetalLookAndFeel");
new TableSample();
}
}
---------- END SOURCE ----------
FREQUENCY : always
java version 11 and above.
Windows 10, 225% screen scale
A DESCRIPTION OF THE PROBLEM :
There is a miss-match between painting of JTable header border and its data grid border. The issue occurs in Metal Look and Feel only. This can be observed when when scaling factor is increased and hence in the example 225% scaling factor is chosen.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Set screen scale on Windows to 225% .
Run code.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
The Table header border should be aligned with data grid vertical lines
ACTUAL -
The Table header border is not aligned with data grid vertical lines
---------- BEGIN SOURCE ----------
import javax.swing.JFrame;
import javax.swing.JScrollPane;
import javax.swing.JTable;
import javax.swing.UIManager;
import javax.swing.UnsupportedLookAndFeelException;
public class TableSample {
JFrame f;
JTable j;
TableSample()
{
f = new JFrame();
f.setTitle("JTable - 225% scaling");
String[][] data = {
{ "Java", "Java", "Java"},
{ "Java", "Java", "Java"}
};
String[] columnNames = { "Size", "Size", "Size"};
j = new JTable(data, columnNames);
j.setBounds(30, 40, 200, 300);
JScrollPane sp = new JScrollPane(j);
f.add(sp);
f.setSize(500, 200);
f.setVisible(true);
}
public static void main(String[] args) throws UnsupportedLookAndFeelException, ClassNotFoundException, InstantiationException, IllegalAccessException {
System.setProperty("sun.java2d.uiScale", "2.25");
UIManager.setLookAndFeel("javax.swing.plaf.metal.MetalLookAndFeel");
new TableSample();
}
}
---------- END SOURCE ----------
FREQUENCY : always