0
I have a method that increases and decreases the width of my table at the click of a button (it works perfectly):
public void toggleTela()
{
if(this.tblAudiencias.getWidth() == 940)
{
this.toogleItens(true);
this.tblAudiencias.setMinWidth(649);
this.tblAudiencias.setLayoutX(287);
this.btnToggle.setText("< Ocultar");
}
else
{
this.toogleItens(false);
this.tblAudiencias.setMinWidth(940);
this.tblAudiencias.setLayoutX(5);
this.btnToggle.setText("> Mostrar");
}
this.redefineColunas(this.tblAudiencias.getWidth());
}
The method redefineColunas
should define the width of the columns according to the table:
private void redefineColunas(double tabela)
{
this.colAudiencia.setMinWidth(tabela * 0.20);
this.colData.setMinWidth(tabela * 0.15);
this.colHora.setMinWidth(tabela * 0.10);
this.colAutor.setMinWidth(tabela * 0.20);
this.colReu.setMinWidth(tabela * 0.15);
this.colProcesso.setMinWidth(tabela * 0.20);
}
The goal was to give a few percentages for each column, when it enters the else
it works, increases the table and columns, but when I click the button again to decrease the table (enter the if
) table is lowered but columns remain large.