Выбор строк в java
I am currently designing my System. I added a cell renderer in order to create an alternate row color on my Jtable but when I insert cell renderer in my code, JTabel selection becomes cell unlike when before I insert the code where the selection is per row. How could I make my JTable as row selection again? (Row selection in my netbeans properties is true, while cell selection is false) Here is the code for the cell renderer
Что я уже пробовал:
tblTable.setDefaultRenderer(Object.class, new TableCellRenderer(){ private DefaultTableCellRenderer DEFAULT_RENDERER = new DefaultTableCellRenderer(); @Override public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { Component c = DEFAULT_RENDERER.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column); if (row%2 == 0){ c.setBackground(Color.WHITE); } else { c.setBackground(Color.LIGHT_GRAY); } return c; } });