How to change the name to a column of a jTable? [closed]

0

In what way could this be done in time of execution, once the names have been previously set?

    
asked by Mengano 13.10.2018 в 02:03
source

1 answer

1

If at the moment of executing the program and then you want to change the columns you would have to implement some method doing the following:

    public void changeColumnName(int __COLUMN__, String __NAME__){
        JTableHeader head = Tabla.getTableHeader();
        TableColumnModel tcm = head.getColumnModel();
        TableColumn tabCM = tcm.getColumn(__COLUMN__);
        tabCM.setHeaderValue(__NAME__);
        Tabla.repaint();
    }

The rest is to call the function and pass the arguments

    
answered by 13.10.2018 / 02:16
source