2
I have the column width sum and I need to set this value so that it does not hide parts of the columns and decrease the window. Any suggestions? I created a method that returns the sum of column size. Then I made another method to add this value to 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 the methods, using the pack() it resizes right, however I have to do this on all windows of the same type, as the same has a basis, making on this basis it would work for all that implement it.
Is there any way you can put what you’ve done so far? I think you can help whoever answers.
– Math
Is this method (autoSetLargura) inside your Jdialog? If yes put the pack() after preferredSize.
– Dener