I have the sum of the width of the columns and I need to set this value so that it does not hide parts of the columns and decrease the window. Any suggestion? I created a method that returns the sum of the size of the columns. Then I made another method to add this value to the one in the window.
public void autoSetLargura(List<Integer> colunas){
Integer soma = getTabelaUtils().setPreferredWidthJanelaColunas(colunas) + 300;
this.setPreferredSize(new Dimension(soma, 500));
}
public Integer setPreferredWidthJanelaColunas(List<Integer> lista) {
//seta as colunas e me retorna a soma delas.
Integer somaColunas = 0;
for (int i = 0; i < lista.size(); i++) {
setPreferredWidthColuna(i, lista.get(i));
somaColunas +=lista.get(i);
}
return somaColunas;
}
These are methods, using the pack () it resizes right, but I have to do this on all windows of the same type, as the same has a base, doing on this basis it would work for all that implement it.