|
15 | 15 | import javax.swing.JComponent; |
16 | 16 | import javax.swing.JScrollBar; |
17 | 17 | import javax.swing.JScrollPane; |
| 18 | +import javax.swing.JTable; |
18 | 19 | import javax.swing.JViewport; |
19 | 20 | import javax.swing.LookAndFeel; |
20 | 21 | import javax.swing.Scrollable; |
@@ -570,7 +571,10 @@ public int getBaseline(JComponent c, int width, int height) { |
570 | 571 | @Override |
571 | 572 | public Insets getInsets() { |
572 | 573 | // AWT only here. |
573 | | - Insets i = scrollpane.getBorder().getBorderInsets(scrollpane); |
| 574 | + Border b = scrollpane.getBorder(); |
| 575 | + if (b == null) |
| 576 | + return null; |
| 577 | + Insets i = b.getBorderInsets(scrollpane); |
574 | 578 | if (!layingOut) { |
575 | 579 | // AWT includes scrollbars in visibility, but the layout manager does not |
576 | 580 | i.right += scrollpane.getVerticalScrollBar().isVisible() ? 12 : 0; |
@@ -1259,8 +1263,10 @@ private void hsbStateChanged(JViewport viewport, ChangeEvent e) { |
1259 | 1263 |
|
1260 | 1264 | private void viewportStateChanged(ChangeEvent e) { |
1261 | 1265 | syncScrollPaneWithViewport(); |
1262 | | - // painted label, button, or canvas anywhere in the tree will need to be repainted after the shift in origin. |
1263 | | - if (jc.秘selfOrChildIsPainted()) |
| 1266 | + // painted label, button, or canvas anywhere in the tree will need to be |
| 1267 | + // repainted after the shift in origin. |
| 1268 | + if (!(scrollpane.getViewport().getView() instanceof JTable) |
| 1269 | + && jc.秘selfOrChildIsPainted()) |
1264 | 1270 | jc.秘repaint(); |
1265 | 1271 | } |
1266 | 1272 |
|
|
0 commit comments