public void addColumns ( int aColumns ) { ArrayList < Row > newRows = new ArrayList < Row > ( rows . size ( ) ) ; int newColumns = columns + aColumns ; Row row ; for ( int i = 0 ; i < rows . size ( ) ; i ++ ) { row = new Row ( newColumns ) ; for ( int j = 0 ; j < columns ; j ++ ) { row . setElement ( ( ( Row ) rows . get ( i ) ) . getCell ( j ) , j ) ; } for ( int j = columns ; j < newColumns && i < curPosition . x ; j ++ ) { row . setElement ( null , j ) ; } newRows . add ( row ) ; } // applied 1 column-fix; last column needs to have a width of 0 float [ ] newWidths = new float [ newColumns ] ; System . arraycopy ( widths , 0 , newWidths , 0 , columns ) ; for ( int j = columns ; j < newColumns ; j ++ ) { newWidths [ j ] = 0 ; } columns = newColumns ; widths = newWidths ; rows = newRows ; }
Gives you the possibility to add columns .