[macosx] JTableHeader painting error with Java 8 on Mac

Alexander Scherbatiy alexandr.scherbatiy at oracle.com
Thu Jun 13 04:54:26 PDT 2013


On 6/11/2013 4:47 PM, Van Den Borre, Koen wrote:
> Hi,
>
> I noticed that on Java 8 on Mac, the JTableHeader looks clipped (the bottom line is not visible).
> This was not an issue in Java 6.

     It seems that there should be newHeight + 1 for the border painting:
http://hg.openjdk.java.net/jdk8/awt/jdk/file/a7d943998bd3/src/macosx/classes/com/apple/laf/AquaTableHeaderBorder.java

       102         final int newX = x;
       103         final int newY = y;
       104         final int newWidth = width;
       105         final int newHeight = height;
       106
       107         painter.paint(g, c, newX - 1, newY - 1, newWidth + 1, 
newHeight);

    This is  a good chance for the JDK 8 patch contribution.

  Thanks,
  Alexandr.

>
> Here is a simple test case:
>
> import javax.swing.JFrame;
> import javax.swing.JScrollPane;
> import javax.swing.JTable;
> import javax.swing.SwingUtilities;
>
> public class JTableHeaderTest
> {
> 	public void run()
> 	{
> 		JTable table = new JTable(2, 5);
> 		
> 		JScrollPane scrollableTable = new JScrollPane(table);
> 		
> 		JFrame frame = new JFrame();
> 		frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
> 		frame.getContentPane().add(scrollableTable);
> 		frame.setSize(300, 300);
> 		frame.setLocationRelativeTo(null);
> 		frame.setVisible(true);
> 	}
>
> 	public static void main(String[] arguments)
> 	{
> 		SwingUtilities.invokeLater(new Runnable()
> 		{
> 			@Override
> 			public void run()
> 			{
> 				JTableHeaderTest test = new JTableHeaderTest();
> 				test.run();
> 			}
> 		});
> 	}
> }



More information about the macosx-port-dev mailing list