2 * Copyright 2000-2009 JetBrains s.r.o.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
18 * created at Oct 5, 2001
21 package com
.intellij
.ui
;
24 import javax
.swing
.table
.TableCellRenderer
;
27 public class BooleanTableCellRenderer
extends JCheckBox
implements TableCellRenderer
{
28 private final JPanel myPanel
= new JPanel();
30 public BooleanTableCellRenderer() {
32 setHorizontalAlignment(JLabel
.CENTER
);
35 public Component
getTableCellRendererComponent(JTable table
, Object value
,
36 boolean isSelected
, boolean hasFocus
,
37 int row
, int column
) {
40 myPanel
.setBackground(table
.getSelectionBackground());
43 myPanel
.setBackground(table
.getBackground());
48 setForeground(table
.getSelectionForeground());
49 super.setBackground(table
.getSelectionBackground());
52 setForeground(table
.getForeground());
53 setBackground(table
.getBackground());
55 if (value
instanceof String
) {
56 setSelected(Boolean
.parseBoolean((String
)value
));
59 setSelected(((Boolean
)value
).booleanValue());