@@ -240,6 +240,8 @@ protected void fillDOM() {
240240 */
241241 boolean isLeftToRight = true ;
242242
243+ private boolean awtScrollPaneNeedsLayout ;
244+
243245 /*
244246 * The bits below define JList property changes that affect layout. When one
245247 * of these properties changes we set a bit in updateLayoutStateNeeded. The
@@ -399,7 +401,6 @@ public void paint(Graphics g, JComponent c) {
399401 }
400402
401403 private void paintImpl (Graphics g , JComponent c ) {
402-
403404 // It is the responsibility of the JScrollPane scrollbar will move the JList
404405 // to new x,y coordinates.
405406
@@ -431,7 +432,6 @@ private void paintImpl(Graphics g, JComponent c) {
431432 if ((renderer == null ) || (size = dataModel .getSize ()) == 0 ) {
432433 return ;
433434 }
434-
435435 // Determine how many columns we need to paint
436436 Rectangle paintBounds = g .getClipBounds ();
437437 int startColumn , endColumn ;
@@ -477,6 +477,12 @@ private void paintImpl(Graphics g, JComponent c) {
477477 rendererPane .removeAll ();
478478 // no -- this will paint the background over the painted backgrounds
479479 // updateDOMNode();
480+ if (awtScrollPaneNeedsLayout ) {
481+ awtScrollPaneNeedsLayout = false ;
482+ scrollPaneUI .jc .layout ();
483+ }
484+
485+
480486 }
481487
482488// private void paintDropLine(Graphics g) {
@@ -1422,6 +1428,8 @@ int convertModelToColumn(int index) {
14221428 */
14231429 protected void maybeUpdateLayoutState () {
14241430 if (updateLayoutStateNeeded != 0 ) {
1431+ if (isAWT && scrollPaneUI != null )
1432+ awtScrollPaneNeedsLayout = true ;
14251433 updateLayoutStateNeeded = 0 ; // SwingJS switch of order here for getting
14261434 // actual size
14271435 updateLayoutState ();
0 commit comments