Skip to content

Commit b23ea20

Browse files
committed
[FIX] table cell coloring (also for selection)
1 parent e770977 commit b23ea20

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

src/main/java/net/seesharpsoft/intellij/plugins/csv/editor/table/swing/MultiLineCellRenderer.java

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,10 @@ public MultiLineCellRenderer(CsvTableEditorKeyListener keyListener, UserDataHold
3333
myTextArea.setLineWrap(true);
3434
myTextArea.setWrapStyleWord(true);
3535
myTextArea.setOpaque(true);
36-
myTextArea.setBorder(null);
3736
myTextArea.setRequestFocusEnabled(true);
3837
myTextArea.addKeyListener(keyListener);
3938
this.setOpaque(true);
39+
this.setBorder(null);
4040
this.setViewportView(myTextArea);
4141
}
4242

@@ -60,20 +60,20 @@ private Color getColumnBackgroundColor(int column, Color fallback) {
6060
@Override
6161
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
6262
if (isSelected) {
63-
setForeground(table.getSelectionForeground());
64-
setBackground(table.getSelectionBackground());
63+
myTextArea.setForeground(table.getSelectionForeground());
64+
myTextArea.setBackground(table.getSelectionBackground());
6565
} else {
66-
setForeground(getColumnForegroundColor(column, table.getForeground()));
67-
setBackground(getColumnBackgroundColor(column, table.getBackground()));
66+
myTextArea.setForeground(getColumnForegroundColor(column, table.getForeground()));
67+
myTextArea.setBackground(getColumnBackgroundColor(column, table.getBackground()));
6868
}
6969
if (hasFocus) {
70-
setBorder(UIManager.getBorder("Table.focusCellHighlightBorder"));
70+
myTextArea.setBorder(UIManager.getBorder("Table.focusCellHighlightBorder"));
7171
if (table.isCellEditable(row, column)) {
72-
setForeground(UIManager.getColor("Table.focusCellForeground"));
73-
setBackground(UIManager.getColor("Table.focusCellBackground"));
72+
myTextArea.setForeground(UIManager.getColor("Table.focusCellForeground"));
73+
myTextArea.setBackground(UIManager.getColor("Table.focusCellBackground"));
7474
}
7575
} else {
76-
setBorder(new EmptyBorder(1, 2, 1, 2));
76+
myTextArea.setBorder(new EmptyBorder(1, 2, 1, 2));
7777
}
7878

7979
final int columnWidth = table.getColumnModel().getColumn(column).getWidth();

0 commit comments

Comments
 (0)