Example usage for javax.swing JTable getSelectionBackground

List of usage examples for javax.swing JTable getSelectionBackground

Introduction

In this page you can find the example usage for javax.swing JTable getSelectionBackground.

Prototype

public Color getSelectionBackground() 

Source Link

Document

Returns the background color for selected cells.

Usage

From source file:com.diversityarrays.kdxplore.curate.MarkerPanelManager.java

public MarkerPanelManager(Trial trial, CurationTableModel curationTableModel, JTable curationTable,
        TitledTablePanelWithResizeControls curationTablePanel, Transformer<TraitInstance, Color> ticp,
        CurationTableSelectionModel ctsm) {
    this.table = curationTable;
    this.curationTableModel = curationTableModel;
    this.traitInstanceColorProvider = ticp;
    this.curationTableSelectionModel = ctsm;

    traitNameStyle = trial.getTraitNameStyle();

    curationTablePanel.scrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);

    markerPanel = new MarkerPanel(curationTablePanel.scrollPane, SwingConstants.VERTICAL);
    Component corner = curationTablePanel.scrollPane.getCorner(JScrollPane.UPPER_RIGHT_CORNER);
    if (corner != null) {
        markerPanel.setHeaderComponent(corner);
    }//from w w w  .jav  a  2 s.co m

    markerPanel.addMarkerMouseClickHandler(mmch);

    // Initialise the table selection marker
    Color selfill = curationTable.getSelectionBackground();

    tableSelectionMarkerGroup = new TableSelectionMarkerGroup(curationTable, selfill);
    markerGroups.add(tableSelectionMarkerGroup);
    markerPanel.addMarkerGroup(tableSelectionMarkerGroup);

    // Then amend the UI
    curationTablePanel.add(markerPanel, BorderLayout.EAST);

    curationTableModel.addPropertyChangeListener(CurationTableModel.PROPERTY_TRAIT_INSTANCES,
            traitInstancesPropertyChangeListener);

    curationTableSelectionModel.addChangeListener(selectionChangeListener);
}

From source file:com.diversityarrays.kdxplore.trials.PlotCellRenderer.java

@Override
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus,
        int row, int column) {
    boolean cellSelected = table.isCellSelected(row, column);

    super.getTableCellRendererComponent(table, value, cellSelected, hasFocus, row, column);

    setToolTipText(null);//from w  w  w.j a va 2  s. com

    commentMarker = null;
    sampleIconType = SampleIconType.NORMAL;
    if (value instanceof Plot) {
        Plot plot = (Plot) value;
        handlePlot(table, isSelected, hasFocus, row, column, cellSelected, plot);
        if (!plot.isActivated()) {
            sampleIconType = isSelected ? SampleIconType.INACTIVE_PLOT_SELECTED : SampleIconType.INACTIVE_PLOT;
        }
    } else {
        if (cellSelected) {
            this.setBackground(table.getSelectionBackground());
            this.setForeground(table.getSelectionForeground());
        } else {
            this.setBackground(table.getBackground());
            this.setForeground(table.getForeground());
        }
    }

    return this;
}

From source file:jp.massbank.spectrumsearch.SearchPage.java

/**
 * ??//w w  w  .j  ava 2  s.c  o m
 */
private void updateSelectQueryTable(JTable tbl) {

    // ?
    this.setCursor(waitCursor);

    int selRow = tbl.getSelectedRow();
    if (selRow >= 0) {
        tbl.clearSelection();
        Color defColor = tbl.getSelectionBackground();
        tbl.setRowSelectionInterval(selRow, selRow);
        tbl.setSelectionBackground(Color.PINK);
        tbl.update(tbl.getGraphics());
        tbl.setSelectionBackground(defColor);
    }
    // ?
    this.setCursor(Cursor.getDefaultCursor());
}

From source file:com.diversityarrays.kdxplore.trials.PlotCellRenderer.java

private void handlePlot(JTable table, boolean isSelected, boolean hasFocus, int row, int column,
        boolean cellSelected, Plot plot) {
    StringBuilder sb = new StringBuilder("<HTML>");

    if (plotVisitList != null) {
        PlotVisitGroup pvg = plotVisitList.getPlotVisitGroup(plot);
        if (pvg != null) {
            WalkSegment ws = pvg.walkSegment;
            sb.append(ws.segmentIndex + 1).append(":").append(ws.orientationUDLR.unicodeArrow).append("<BR>");
        }//w ww.  j av  a2 s  . co m
    }

    if (showUserPlotId) {
        sb.append("<b>").append(plot.getUserPlotId()).append("</b>");
    }

    //      Collection<String> tagLabels = plot.getTagLabels();
    // Instead of the above, collect for all SampleGroups
    Set<String> tagLabels = plot.getTagsBySampleGroup().entrySet().stream().flatMap(e -> e.getValue().stream())
            .map(tag -> tag.getLabel()).collect(Collectors.toSet());

    addAnnotations(plot, tagLabels, sb);

    String plotType = plot.getPlotType();
    if (plotType != null && !plotType.isEmpty()) {
        sb.append(": <i>").append(StringUtil.htmlEscape(plotType)).append("</i>");
    }

    Pair<Integer, Integer> cell = new Pair<Integer, Integer>(row, column);

    Map<TraitInstance, Comparable<?>> tempMap = new HashMap<TraitInstance, Comparable<?>>();
    if (temporaryValues.containsKey(cell)) {
        tempMap = temporaryValues.get(cell);
    }

    boolean anyAttributesAdded = false;

    if (attributeNames != null && !attributeNames.isEmpty()) {
        if (plot.plotAttributeValues != null) {
            for (PlotAttributeValue pav : plot.plotAttributeValues) {
                if (attributeNames.contains(pav.plotAttributeName)) {
                    anyAttributesAdded = true;
                    String attrValue = pav.getAttributeValue();
                    sb.append("<br/>");
                    PlotAttribute pa = plotAttributeProvider.transform(pav);
                    sb.append("<i>").append(StringUtil.htmlEscape(pa.getPlotAttributeName())).append("</i>");
                    sb.append(": ");
                    if (attrValue == null) {
                        sb.append("-no-value-");
                    } else {
                        sb.append(StringUtil.htmlEscape(attrValue));
                    }
                }
            }
        }
    }

    String tttResult = null;
    if (!traitInstancesByTraitId.isEmpty()) {
        // Appends html to sb. Also sets commentMarker
        tttResult = collectCellHtml(isSelected, plot, sb, tempMap);
    }
    if (!Check.isEmpty(tagLabels)) {
        StringBuilder tmp = new StringBuilder();
        if (tttResult != null) {
            if (!tttResult.startsWith("<HTML>")) {
                tmp.append("<HTML>");
            }
            tmp.append(tttResult).append("<br>");
        } else {
            tmp.append("<HTML>");
        }
        String tagsep = "";
        for (String tag : tagLabels) {
            tmp.append(tagsep).append(tag);
            tagsep = ", ";
        }
        tttResult = tmp.toString();
    }
    setToolTipText(tttResult);

    if (activeInstance != null) {
        Color c = colorProvider == null ? table.getSelectionBackground()
                : colorProvider.getTraitInstanceColor(activeInstance).getBackground();

        if (!cellSelected) {
            cellSelected = fieldViewSelectionModel.isSelectedPlot(plot);
        }

        if (cellSelected) {
            this.setBackground(c);
            this.setForeground(table.getForeground());
        } else {
            this.setBackground(table.getBackground());
            this.setForeground(table.getForeground());
        }
    } else {
        if (cellSelected) {
            this.setBackground(table.getSelectionBackground());
            this.setForeground(table.getSelectionForeground());
        } else {
            this.setBackground(table.getBackground());
            this.setForeground(table.getForeground());
        }
    }

    setText(sb.toString());
    if (isSelected && hasFocus) {
        setBorder(focusSelectedCellHighlightBorder);
    } else {
        setBorder(border);
    }
}

From source file:com.mirth.connect.connectors.http.HttpListener.java

private void initComponentsManual() {
    staticResourcesTable.setModel(new RefreshTableModel(StaticResourcesColumn.getNames(), 0) {
        @Override/*from  ww w  .ja  v a 2 s .  co m*/
        public boolean isCellEditable(int rowIndex, int columnIndex) {
            return true;
        }
    });

    staticResourcesTable.putClientProperty("terminateEditOnFocusLost", Boolean.TRUE);
    staticResourcesTable.setRowHeight(UIConstants.ROW_HEIGHT);
    staticResourcesTable.setFocusable(true);
    staticResourcesTable.setSortable(false);
    staticResourcesTable.setOpaque(true);
    staticResourcesTable.setDragEnabled(false);
    staticResourcesTable.getTableHeader().setReorderingAllowed(false);
    staticResourcesTable.setShowGrid(true, true);
    staticResourcesTable.setAutoCreateColumnsFromModel(false);
    staticResourcesTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    staticResourcesTable.setRowSelectionAllowed(true);
    staticResourcesTable.setCustomEditorControls(true);

    if (Preferences.userNodeForPackage(Mirth.class).getBoolean("highlightRows", true)) {
        staticResourcesTable.setHighlighters(HighlighterFactory
                .createAlternateStriping(UIConstants.HIGHLIGHTER_COLOR, UIConstants.BACKGROUND_COLOR));
    }

    class ContextPathCellEditor extends TextFieldCellEditor {
        public ContextPathCellEditor() {
            getTextField().setDocument(new MirthFieldConstraints("^\\S*$"));
        }

        @Override
        protected boolean valueChanged(String value) {
            if (StringUtils.isEmpty(value) || value.equals("/")) {
                return false;
            }

            if (value.equals(getOriginalValue())) {
                return false;
            }

            for (int i = 0; i < staticResourcesTable.getRowCount(); i++) {
                if (value.equals(fixContentPath((String) staticResourcesTable.getValueAt(i,
                        StaticResourcesColumn.CONTEXT_PATH.getIndex())))) {
                    return false;
                }
            }

            parent.setSaveEnabled(true);
            return true;
        }

        @Override
        public Object getCellEditorValue() {
            String value = fixContentPath((String) super.getCellEditorValue());
            String baseContextPath = getBaseContextPath();
            if (value.equals(baseContextPath)) {
                return null;
            } else {
                return fixContentPath(StringUtils.removeStartIgnoreCase(value, baseContextPath + "/"));
            }
        }

        @Override
        public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, int row,
                int column) {
            String resourceContextPath = fixContentPath((String) value);
            setOriginalValue(resourceContextPath);
            getTextField().setText(getBaseContextPath() + resourceContextPath);
            return getTextField();
        }
    }
    ;

    staticResourcesTable.getColumnExt(StaticResourcesColumn.CONTEXT_PATH.getIndex())
            .setCellEditor(new ContextPathCellEditor());
    staticResourcesTable.getColumnExt(StaticResourcesColumn.CONTEXT_PATH.getIndex())
            .setCellRenderer(new DefaultTableCellRenderer() {
                @Override
                protected void setValue(Object value) {
                    super.setValue(getBaseContextPath() + fixContentPath((String) value));
                }
            });

    class ResourceTypeCellEditor extends MirthComboBoxTableCellEditor implements ActionListener {
        private Object originalValue;

        public ResourceTypeCellEditor(JTable table, Object[] items, int clickCount, boolean focusable) {
            super(table, items, clickCount, focusable, null);
            for (ActionListener actionListener : comboBox.getActionListeners()) {
                comboBox.removeActionListener(actionListener);
            }
            comboBox.addActionListener(this);
        }

        @Override
        public boolean stopCellEditing() {
            if (ObjectUtils.equals(getCellEditorValue(), originalValue)) {
                cancelCellEditing();
            } else {
                parent.setSaveEnabled(true);
            }
            return super.stopCellEditing();
        }

        @Override
        public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, int row,
                int column) {
            originalValue = value;
            return super.getTableCellEditorComponent(table, value, isSelected, row, column);
        }

        @Override
        public void actionPerformed(ActionEvent evt) {
            ((AbstractTableModel) staticResourcesTable.getModel()).fireTableCellUpdated(
                    staticResourcesTable.getSelectedRow(), StaticResourcesColumn.VALUE.getIndex());
            stopCellEditing();
            fireEditingStopped();
        }
    }

    String[] resourceTypes = ResourceType.stringValues();
    staticResourcesTable.getColumnExt(StaticResourcesColumn.RESOURCE_TYPE.getIndex()).setMinWidth(100);
    staticResourcesTable.getColumnExt(StaticResourcesColumn.RESOURCE_TYPE.getIndex()).setMaxWidth(100);
    staticResourcesTable.getColumnExt(StaticResourcesColumn.RESOURCE_TYPE.getIndex())
            .setCellEditor(new ResourceTypeCellEditor(staticResourcesTable, resourceTypes, 1, false));
    staticResourcesTable.getColumnExt(StaticResourcesColumn.RESOURCE_TYPE.getIndex())
            .setCellRenderer(new MirthComboBoxTableCellRenderer(resourceTypes));

    class ValueCellEditor extends AbstractCellEditor implements TableCellEditor {

        private JPanel panel;
        private JLabel label;
        private JTextField textField;
        private String text;
        private String originalValue;

        public ValueCellEditor() {
            panel = new JPanel(new MigLayout("insets 0 1 0 0, novisualpadding, hidemode 3"));
            panel.setBackground(UIConstants.BACKGROUND_COLOR);

            label = new JLabel();
            label.addMouseListener(new MouseAdapter() {
                @Override
                public void mouseReleased(MouseEvent evt) {
                    new ValueDialog();
                    stopCellEditing();
                }
            });
            panel.add(label, "grow, pushx, h 19!");

            textField = new JTextField();
            panel.add(textField, "grow, pushx, h 19!");
        }

        @Override
        public boolean isCellEditable(EventObject evt) {
            if (evt == null) {
                return false;
            }
            if (evt instanceof MouseEvent) {
                return ((MouseEvent) evt).getClickCount() >= 2;
            }
            return true;
        }

        @Override
        public Object getCellEditorValue() {
            if (label.isVisible()) {
                return text;
            } else {
                return textField.getText();
            }
        }

        @Override
        public boolean stopCellEditing() {
            if (ObjectUtils.equals(getCellEditorValue(), originalValue)) {
                cancelCellEditing();
            } else {
                parent.setSaveEnabled(true);
            }
            return super.stopCellEditing();
        }

        @Override
        public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, int row,
                int column) {
            boolean custom = table.getValueAt(row, StaticResourcesColumn.RESOURCE_TYPE.getIndex())
                    .equals(ResourceType.CUSTOM.toString());
            label.setVisible(custom);
            textField.setVisible(!custom);

            panel.setBackground(table.getSelectionBackground());
            label.setBackground(panel.getBackground());
            label.setMaximumSize(new Dimension(table.getColumnModel().getColumn(column).getWidth(), 19));

            String text = (String) value;
            this.text = text;
            originalValue = text;
            label.setText(text);
            textField.setText(text);

            return panel;
        }

        class ValueDialog extends MirthDialog {

            public ValueDialog() {
                super(parent, true);
                setTitle("Custom Value");
                setPreferredSize(new Dimension(600, 500));
                setLayout(new MigLayout("insets 12, novisualpadding, hidemode 3, fill", "", "[grow]7[]"));
                setBackground(UIConstants.BACKGROUND_COLOR);
                getContentPane().setBackground(getBackground());

                final MirthSyntaxTextArea textArea = new MirthSyntaxTextArea();
                textArea.setSaveEnabled(false);
                textArea.setText(text);
                textArea.setBorder(BorderFactory.createEtchedBorder());
                add(textArea, "grow");

                add(new JSeparator(), "newline, grow");

                JPanel buttonPanel = new JPanel(new MigLayout("insets 0, novisualpadding, hidemode 3"));
                buttonPanel.setBackground(getBackground());

                JButton openFileButton = new JButton("Open File...");
                openFileButton.addActionListener(new ActionListener() {
                    @Override
                    public void actionPerformed(ActionEvent evt) {
                        String content = parent.browseForFileString(null);
                        if (content != null) {
                            textArea.setText(content);
                        }
                    }
                });
                buttonPanel.add(openFileButton);

                JButton okButton = new JButton("OK");
                okButton.addActionListener(new ActionListener() {
                    @Override
                    public void actionPerformed(ActionEvent evt) {
                        text = textArea.getText();
                        label.setText(text);
                        textField.setText(text);
                        staticResourcesTable.getModel().setValueAt(text, staticResourcesTable.getSelectedRow(),
                                StaticResourcesColumn.VALUE.getIndex());
                        parent.setSaveEnabled(true);
                        dispose();
                    }
                });
                buttonPanel.add(okButton);

                JButton cancelButton = new JButton("Cancel");
                cancelButton.addActionListener(new ActionListener() {
                    @Override
                    public void actionPerformed(ActionEvent evt) {
                        dispose();
                    }
                });
                buttonPanel.add(cancelButton);

                add(buttonPanel, "newline, right");

                pack();
                setLocationRelativeTo(parent);
                setVisible(true);
            }
        }
    }
    ;

    staticResourcesTable.getColumnExt(StaticResourcesColumn.VALUE.getIndex())
            .setCellEditor(new ValueCellEditor());

    staticResourcesTable.getColumnExt(StaticResourcesColumn.CONTENT_TYPE.getIndex()).setMinWidth(100);
    staticResourcesTable.getColumnExt(StaticResourcesColumn.CONTENT_TYPE.getIndex()).setMaxWidth(150);
    staticResourcesTable.getColumnExt(StaticResourcesColumn.CONTENT_TYPE.getIndex())
            .setCellEditor(new TextFieldCellEditor() {
                @Override
                protected boolean valueChanged(String value) {
                    if (value.equals(getOriginalValue())) {
                        return false;
                    }
                    parent.setSaveEnabled(true);
                    return true;
                }
            });

    staticResourcesTable.getSelectionModel().addListSelectionListener(new ListSelectionListener() {
        @Override
        public void valueChanged(ListSelectionEvent evt) {
            if (getSelectedRow(staticResourcesTable) != -1) {
                staticResourcesLastIndex = getSelectedRow(staticResourcesTable);
                staticResourcesDeleteButton.setEnabled(true);
            } else {
                staticResourcesDeleteButton.setEnabled(false);
            }
        }
    });

    contextPathField.getDocument().addDocumentListener(new DocumentListener() {
        @Override
        public void insertUpdate(DocumentEvent evt) {
            changedUpdate(evt);
        }

        @Override
        public void removeUpdate(DocumentEvent evt) {
            changedUpdate(evt);
        }

        @Override
        public void changedUpdate(DocumentEvent evt) {
            ((AbstractTableModel) staticResourcesTable.getModel()).fireTableDataChanged();
        }
    });

    staticResourcesDeleteButton.setEnabled(false);
}

From source file:org.dc.file.search.ui.DashboardForm.java

public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus,
        int row, int column) {
    setBackground(isSelected ? table.getSelectionBackground() : table.getBackground());
    return this;
}

From source file:org.dc.file.search.ui.DashboardForm.java

public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, int row,
        int column) {
    this.setBackground(table.getSelectionBackground());
    return this;
}

From source file:org.dc.file.search.ui.DashboardForm.java

@Override
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus,
        int row, int column) {
    setBackground(isSelected ? table.getSelectionBackground() : table.getBackground());
    if (jTable != null) {
        String fileName;// ww  w. ja va2s.com
        String comment = "";
        if (type == DashboardForm.StarRatingsType.COMMENT) {
            comment = (String) jTable.getModel().getValueAt(row, DashboardForm.COMMENT_COL_INDEX);
            fileName = selectedFile;
        } else {
            fileName = (String) jTable.getModel().getValueAt(row, DashboardForm.FILE_COL_INDEX);
        }
        updateValue((StarRater) value, fileName, comment, type);
    }
    return this;
}

From source file:org.dc.file.search.ui.DashboardForm.java

@Override
public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, int row,
        int column) {
    this.setBackground(table.getSelectionBackground());
    String fileName;/*from w  w  w .  java2 s  . c  o m*/
    String comment = "";
    if (type == DashboardForm.StarRatingsType.COMMENT) {
        comment = (String) jTable.getModel().getValueAt(row, DashboardForm.COMMENT_COL_INDEX);
        fileName = selectedFile;
    } else {
        fileName = (String) jTable.getModel().getValueAt(row, DashboardForm.FILE_COL_INDEX);
    }
    jTable.getModel().setValueAt(value, row, DashboardForm.STAR_RATINGS_COL_INDEX);
    updateValue((StarRater) value, fileName, comment, type);
    return this;
}

From source file:org.nuclos.client.ui.collect.component.AbstractCollectableComponent.java

public static void setBackgroundColor(Component cellRendererComponent, JTable tbl, Object oValue,
        boolean bSelected, boolean bHasFocus, int iRow, int iColumn) {
    cellRendererComponent.setBackground(bSelected ? tbl.getSelectionBackground()
            : iRow % 2 == 0 ? tbl.getBackground() : NuclosThemeSettings.BACKGROUND_PANEL);
    cellRendererComponent.setForeground(bSelected ? tbl.getSelectionForeground() : tbl.getForeground());

    final TableModel tm;
    final int adjustColIndex;
    if (tbl instanceof FixedColumnRowHeader.HeaderTable
            && ((FixedColumnRowHeader.HeaderTable) tbl).getExternalTable() != null) {
        tm = ((FixedColumnRowHeader.HeaderTable) tbl).getExternalTable().getModel();
        adjustColIndex = FixedRowIndicatorTableModel.ROWMARKERCOLUMN_COUNT;
    } else {/*  w ww  .j  a  v  a 2 s .c om*/
        tm = tbl.getModel();
        adjustColIndex = 0;
    }

    // check whether the data of the component is readable for current user, by asking the security agent of the actual field
    if (tm instanceof SortableCollectableTableModel<?>) {
        final SortableCollectableTableModel<Collectable> tblModel = (SortableCollectableTableModel<Collectable>) tm;
        if (tblModel.getRowCount() > iRow) {
            final Collectable clct = tblModel.getCollectable(iRow);
            final Integer iTColumn = tbl.getColumnModel().getColumn(iColumn).getModelIndex() - adjustColIndex;
            final CollectableEntityField clctef = tblModel.getCollectableEntityField(iTColumn);
            if (clctef == null) {
                throw new NullPointerException("getTableCellRendererComponent failed to find field: " + clct
                        + " tm index " + iTColumn);
            }

            boolean isEnabled = true;
            if (!clctef.isNullable() && isNull(oValue)) {
                cellRendererComponent.setBackground(getMandatoryColor());
                cellRendererComponent.setForeground(tbl.getForeground());
            } else {
                //               if (clct.getId() == null) {
                //                  cellRendererComponent.setBackground(tbl.getBackground());
                //                  cellRendererComponent.setForeground(tbl.getForeground());
                //               } else {
                if (tbl instanceof SubForm.SubFormTable) {
                    SubFormTable subformtable = (SubForm.SubFormTable) tbl;
                    Column subformcolumn = subformtable.getSubForm().getColumn(clctef.getName());
                    if (subformcolumn != null && !subformcolumn.isEnabled()) {
                        isEnabled = false;
                        if (bSelected) {
                            cellRendererComponent
                                    .setBackground(NuclosThemeSettings.BACKGROUND_INACTIVESELECTEDCOLUMN);
                        } else {
                            cellRendererComponent.setBackground(NuclosThemeSettings.BACKGROUND_INACTIVECOLUMN);
                        }
                    }
                }
                //               }

                try {
                    EntityMetaDataVO meta = MetaDataClientProvider.getInstance()
                            .getEntity(clctef.getEntityName());
                    if (meta.getRowColorScript() != null && !bSelected) {
                        AbstractCollectableComponent.setBackground(cellRendererComponent,
                                meta.getRowColorScript(), clct, meta, isEnabled);
                    }
                } catch (CommonFatalException ex) {
                    LOG.warn(ex);
                }
            }
        }
    }

    if (tbl instanceof TableRowMouseOverSupport) {
        TableRowMouseOverSupport trmos = (TableRowMouseOverSupport) tbl;
        if (trmos.isMouseOverRow(iRow)) {
            final Color bgColor = LangUtils.defaultIfNull(cellRendererComponent.getBackground(), Color.WHITE);
            cellRendererComponent
                    .setBackground(new Color(Math.max(0, bgColor.getRed() - (bgColor.getRed() * 8 / 100)),
                            Math.max(0, bgColor.getGreen() - (bgColor.getGreen() * 8 / 100)),
                            Math.max(0, bgColor.getBlue() - (bgColor.getBlue() * 8 / 100))));
            //            cellRendererComponent.setBackground(UIManager.getColor("Table.selectionBackground"));
        }
    }
}