Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class MyTableModel extends AbstractTableModel {
- private String[] columnNames = {"Prénom", "Nom", "Couleur favorite", "Homme", "Sport"};
- private Object[][] data = {
- {"Johnathan", "Sykes", Color.red, true, "TENNIS"},
- {"Nicolas", "Van de Kampf", Color.black, true, "FOOTBALL"},
- {"Damien", "Cuthbert", Color.cyan, true, "RIEN"},
- {"Corinne", "Valance", Color.blue, false, ".NATATION"},
- {"Emilie", "Schrödinger", Color.magenta, false, ".FOOTBALL"},
- {"Delphine", "Duke", Color.yellow, false, ".TENNIS"},
- {"Eric", "Trump", Color.pink, true, ".FOOTBALL"},
- };
- public int getColumnCount() {
- return columnNames.length;
- }
- public int getRowCount() {
- return data.length;
- }
- public String getColumnName(int col) {
- return columnNames[col];
- }
- public Object getValueAt(int row, int col) {
- return data[row][col];
- }
- public Class getColumnClass(int c) {
- return getValueAt(0, c).getClass();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement