Browse Source

Everywhere: Remove calls to internal API SwingUtilities2::drawHLine and SwingUtilities2::drawVLine.

pull/245/head
weisj 4 years ago
parent
commit
1d7127adc8
No known key found for this signature in database
GPG Key ID: 31124CB75461DA2A
  1. 18
      core/src/main/java/com/github/weisj/darklaf/graphics/PaintUtil.java
  2. 8
      core/src/main/java/com/github/weisj/darklaf/ui/table/DarkTableUI.java

18
core/src/main/java/com/github/weisj/darklaf/graphics/PaintUtil.java

@ -275,4 +275,22 @@ public final class PaintUtil {
public static void fillRect(final Graphics g, final int x, final int y, final int w, final int h) { public static void fillRect(final Graphics g, final int x, final int y, final int w, final int h) {
g.fillRect(x, y, w, h); g.fillRect(x, y, w, h);
} }
public static void drawVLine(final Graphics g, int x, int y1, int y2) {
if (y2 < y1) {
final int temp = y2;
y2 = y1;
y1 = temp;
}
g.fillRect(x, y1, 1, y2 - y1 + 1);
}
public static void drawHLine(final Graphics g, int x1, int x2, int y) {
if (x2 < x1) {
final int temp = x2;
x2 = x1;
x1 = temp;
}
g.fillRect(x1, y, x2 - x1 + 1, 1);
}
} }

8
core/src/main/java/com/github/weisj/darklaf/ui/table/DarkTableUI.java

@ -172,7 +172,7 @@ public class DarkTableUI extends DarkTableUIBridge implements TableConstants, Ha
int y = damagedArea.y; int y = damagedArea.y;
for (int row = rMin; row <= rMax; row++) { for (int row = rMin; row <= rMax; row++) {
y += table.getRowHeight(row); y += table.getRowHeight(row);
SwingUtilities2.drawHLine(g, damagedArea.x, tableWidth - 1, y - 1); PaintUtil.drawHLine(g, damagedArea.x, tableWidth - 1, y - 1);
} }
} }
@ -185,14 +185,14 @@ public class DarkTableUI extends DarkTableUIBridge implements TableConstants, Ha
boolean ltr = table.getComponentOrientation().isLeftToRight(); boolean ltr = table.getComponentOrientation().isLeftToRight();
x = damagedArea.x; x = damagedArea.x;
if (scrollPaneRtl && scrollBarVisible()) { if (scrollPaneRtl && scrollBarVisible()) {
SwingUtilities2.drawVLine(g, x, 0, tableHeight - 1); PaintUtil.drawVLine(g, x, 0, tableHeight - 1);
} }
if (ltr) { if (ltr) {
for (int column = cMin; column <= cMax; column++) { for (int column = cMin; column <= cMax; column++) {
int w = cm.getColumn(column).getWidth(); int w = cm.getColumn(column).getWidth();
x += w; x += w;
if (showVerticalLine(true, scrollVisible, !scrollPaneRtl, column, draggedIndex, cMin, cMax)) { if (showVerticalLine(true, scrollVisible, !scrollPaneRtl, column, draggedIndex, cMin, cMax)) {
SwingUtilities2.drawVLine(g, x - 1, 0, tableHeight - 1); PaintUtil.drawVLine(g, x - 1, 0, tableHeight - 1);
} }
} }
} else { } else {
@ -200,7 +200,7 @@ public class DarkTableUI extends DarkTableUIBridge implements TableConstants, Ha
int w = cm.getColumn(column).getWidth(); int w = cm.getColumn(column).getWidth();
x += w; x += w;
if (showVerticalLine(false, scrollVisible, !scrollPaneRtl, column, draggedIndex, cMin, cMax)) { if (showVerticalLine(false, scrollVisible, !scrollPaneRtl, column, draggedIndex, cMin, cMax)) {
SwingUtilities2.drawVLine(g, x - 1, 0, tableHeight - 1); PaintUtil.drawVLine(g, x - 1, 0, tableHeight - 1);
} }
} }
} }

Loading…
Cancel
Save