コード例 #1
0
 @Override
 public void setBackground(Color bg) {
   // allows for striped tables
   if (myEditor != null) {
     myEditor.setBackgroundColor(bg);
   }
   super.setBackground(bg);
 }
コード例 #2
0
  @Override
  public Component getTableCellRendererComponent(
      JTable table, Object value, boolean selected, boolean focused, int row, int column) {
    RendererComponent panel = getEditorPanel(table);
    EditorEx editor = panel.getEditor();
    editor.getColorsScheme().setEditorFontSize(table.getFont().getSize());

    editor
        .getColorsScheme()
        .setColor(EditorColors.SELECTION_BACKGROUND_COLOR, table.getSelectionBackground());
    editor
        .getColorsScheme()
        .setColor(EditorColors.SELECTION_FOREGROUND_COLOR, table.getSelectionForeground());
    editor.setBackgroundColor(selected ? table.getSelectionBackground() : table.getBackground());
    panel.setSelected(!Comparing.equal(editor.getBackgroundColor(), table.getBackground()));

    panel.setBorder(
        null); // prevents double border painting when ExtendedItemRendererComponentWrapper is used

    customizeEditor(editor, table, value, selected, row, column);
    return panel;
  }