From b14d2905e2e97b9356bdc56a555edcea1e6aa1de Mon Sep 17 00:00:00 2001 From: "Henry.Wang" Date: Tue, 24 Aug 2021 14:15:48 +0800 Subject: [PATCH] =?UTF-8?q?REPORT-57872=20=E6=95=B0=E6=8D=AE=E9=9B=86-?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E5=BA=93=E6=9F=A5=E8=AF=A2=E6=97=B6=E5=80=99?= =?UTF-8?q?=EF=BC=8C=E5=88=97=E5=90=8D=E4=B9=8B=E9=97=B4=E7=9A=84=E5=88=86?= =?UTF-8?q?=E9=9A=94=E7=AC=A6=E6=B2=A1=E4=BA=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../data/datapane/preview/CopyableJTable.java | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/data/datapane/preview/CopyableJTable.java b/designer-base/src/main/java/com/fr/design/data/datapane/preview/CopyableJTable.java index 7baf51ddd..eb8d188a1 100644 --- a/designer-base/src/main/java/com/fr/design/data/datapane/preview/CopyableJTable.java +++ b/designer-base/src/main/java/com/fr/design/data/datapane/preview/CopyableJTable.java @@ -48,9 +48,17 @@ public class CopyableJTable extends SortableJTable { boolean mouseDrag = false; boolean headerSelect = false; - DefaultTableCellRenderer tableHeaderCellRenderer = new DefaultTableCellRenderer() { + + class CopyableTableHeaderCellRenderer implements TableCellRenderer { + TableCellRenderer tableCellRenderer; + + CopyableTableHeaderCellRenderer(TableCellRenderer tableCellRenderer) { + this.tableCellRenderer = tableCellRenderer; + } + + @Override public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { - JComponent comp = (JComponent) super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column); + JComponent comp = (JComponent) this.tableCellRenderer.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column); if (isChoose(row, column)) { comp.setBackground(selectBackGround); } else { @@ -58,13 +66,13 @@ public class CopyableJTable extends SortableJTable { } return comp; } - }; + } public CopyableJTable(TableSorter tableModel) { super(tableModel); initListener(); - this.getTableHeader().setDefaultRenderer(tableHeaderCellRenderer); + this.getTableHeader().setDefaultRenderer(new CopyableTableHeaderCellRenderer(this.getTableHeader().getDefaultRenderer())); } private void initListener() {