public void setTablaPrincipal(java.util.List val) { DefaultTableModel modelo = ((DefaultTableModel) this.tablaPrincipal.getModel()); for (int i = 0; i < val.size(); i++) { modelo.addRow(((java.util.ArrayList) val.get(i)).toArray()); } this.calculaSumas(); }
public void keyPressed(KeyEvent ke) { if (ke.getKeyCode() == ke.VK_TAB) { int x = ((JTable) ke.getSource()).getSelectedColumn(); int y = ((JTable) ke.getSource()).getSelectedRow(); int maxX = ((JTable) ke.getSource()).getColumnCount(); int maxY = ((JTable) ke.getSource()).getRowCount(); TableModel tm = ((JTable) ke.getSource()).getModel(); if (x == maxX - 1 && y == maxY - 1) { ((DefaultTableModel) tm).addRow(new Object[maxX]); } } }