On Thu, 7 Apr 2022 09:17:02 GMT, Prasanta Sadhukhan <psadhuk...@openjdk.org> wrote:
> Issue was when printing a JTable which sits inside a JScrollPane and the > table is scrolled down to the end to about 1000th row, only the first page is > printed. > This is because when the table is scrolled down to last page, the bounds.y > becomes -ve > [x=0,y=-15260,width=968,height=16000] > so the check `if (!((table.getBounds()).intersects(clip)))` is satisfied only > for 1st page where bounds just intersects the clip > [x=0,y=0,width=968,height=1296] > but subsequent pages clip > [[x=0,y=1296,width=968,height=1296], > [x=0,y=2592,width=968,height=1296], > [x=0,y=3888,width=968,height=1296] etc is not intesecting so they are not > printed > > This is a regression of JDK-8081491 which was **reworked** in JDK-8236907 > where the bounds calculation and usage is made same as in BasicTableUI > We need to use the same resetted bounds for this intersection calculation too > as was done for JDK-8236907 > > Tested against JDK-8081491, 8170349, JDK-8236907 testcases along with other > regression tests and all are OK (link in JBS) test/jdk/javax/swing/JTable/PrintAllPagesTest.java line 53: > 51: PrintAllPages test = new PrintAllPages(latch); > 52: Thread T1 = new Thread(test); > 53: T1.start(); I wonder why you need another thread to create UI. You can create UI from calling `invokeAndWait` from main thread as it's usually done and then start to wait on the latch. The two classes can be merged into one. test/jdk/javax/swing/JTable/PrintAllPagesTest.java line 61: > 59: } catch (InterruptedException ie) { > 60: throw ie; > 61: } The catch block does nothing but re-throws the exception. Thus, it can be removed. test/jdk/javax/swing/JTable/PrintAllPagesTest.java line 63: > 61: } > 62: if (!ret) { > 63: test.dispose(); Why isn't `test.dispose()` called when the test pass? If `latch.await` is interrupted, the test isn't disposed. And UI should be disposed of on EDT. test/jdk/javax/swing/JTable/PrintAllPagesTest.java line 126: > 124: Rectangle bounds = super.getBounds(); > 125: return bounds; > 126: } Is this overridden method used by any means? ------------- PR: https://git.openjdk.java.net/jdk/pull/8141