import javax.swing.*;
import javax.swing.table.TableCellRenderer;
import java.awt.*;
public class MyTable extends JTable {
public MyTable(TableModel model) {
super(model);
}
@Override
public Component prepareRenderer(TableCellRenderer renderer, int row, int column) {
Component c = super.prepareRenderer(renderer, row, column);
if (!c.getBackground().equals(getSelectionBackground())) {
Color colour = (row % 2 == 0 ? Color.WHITE : Color.LIGHT_GRAY);
c.setBackground(colour);
}
return c;
}
}
Code Example |
---|
:: |
:: |
:: |
Java :: |
Java :: |
Java :: |
:: decimals java |
:: |
Java :: Date from String java3 |
:: |
:: java stop program |
:: |
Java :: |
Java :: discord jda get message by id |
:: how to check if a char is equal to int java |
:: |
Java :: java get longest string in array |
:: |
:: |
:: |
:: |
Java :: |
Java :: how to create a random number in java |
:: how to count lines from txt java |
Java :: |
:: |
Java :: |
:: |
:: |
:: |