Exemplo n.º 1
0
 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();
 }
Exemplo n.º 2
0
    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]);
        }
      }
    }