Skip to content

Commit e45aedf

Browse files
hansonrhansonr
authored andcommitted
Don't repaint JTable from JSScrollPaneUI if it is a view
1 parent 25e2e1e commit e45aedf

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

sources/net.sf.j2s.java.core/src/swingjs/plaf/JSScrollPaneUI.java

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
import javax.swing.JComponent;
1616
import javax.swing.JScrollBar;
1717
import javax.swing.JScrollPane;
18+
import javax.swing.JTable;
1819
import javax.swing.JViewport;
1920
import javax.swing.LookAndFeel;
2021
import javax.swing.Scrollable;
@@ -570,7 +571,10 @@ public int getBaseline(JComponent c, int width, int height) {
570571
@Override
571572
public Insets getInsets() {
572573
// 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);
574578
if (!layingOut) {
575579
// AWT includes scrollbars in visibility, but the layout manager does not
576580
i.right += scrollpane.getVerticalScrollBar().isVisible() ? 12 : 0;
@@ -1259,8 +1263,10 @@ private void hsbStateChanged(JViewport viewport, ChangeEvent e) {
12591263

12601264
private void viewportStateChanged(ChangeEvent e) {
12611265
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())
12641270
jc.秘repaint();
12651271
}
12661272

0 commit comments

Comments
 (0)