|
|
|
jXTable цвет строк
|
|||
|---|---|---|---|
|
#18+
Добрый день. Подскажите новичку. Хочу раскрасить строки таблицы в зависимости от значений в строке. на jTable работает вроде, на JXTable меняет не цвет заливки, а цвет selectedRow. DefaultTableCellRenderer renderer = new DefaultTableCellRenderer() { public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { super.getTableCellRendererComponent(table, value, false, hasFocus, row, column); setHorizontalAlignment(SwingConstants.CENTER); if (table.getValueAt(row, ColumnIndex.getColumnIndex((JXTable) table, "Статус GM")).toString().equals("Не активный")) { setBackground(Color.RED); } else if (table.getValueAt(row, ColumnIndex.getColumnIndex((JXTable) table, "Статус GM")).toString().equals("В разработке")) { setBackground(Color.GREEN); } else if (table.getValueAt(row, ColumnIndex.getColumnIndex((JXTable) table, "Статус GM")).toString().equals("Нет в системе")) { setBackground(Color.RED); } else { setBackground(Color.white); } return this; } }; for(int i=0; i<jXTableServiceMainAll.getColumnCount(); i++){ jXTableServiceMainAll.getColumnModel().getColumn(i).setCellRenderer(renderer); } Выделеные строки выделяются цветом который я указал. Как сделать что бы они закрашивались? Спасибо ... |
|||
|
:
Нравится:
Не нравится:
|
|||
| 19.10.2015, 17:43 |
|
||
|
|

start [/forum/topic.php?fid=59&tid=2124807]: |
0ms |
get settings: |
8ms |
get forum list: |
20ms |
check forum access: |
3ms |
check topic access: |
3ms |
track hit: |
36ms |
get topic data: |
11ms |
get forum data: |
3ms |
get page messages: |
43ms |
get tp. blocked users: |
1ms |
| others: | 198ms |
| total: | 326ms |

| 0 / 0 |
