JTable change object type row java netbeans

0

Good, I have a problem if I want for example that each column of a table can store a different type of object, for example in the first column a string and in the second a double,

How can I do it?

Thanks in advance.

    
asked by barraca96 07.04.2017 в 09:17
source

1 answer

0

I do not understand the question, the DefaultTableModel that you can use to build your table with the values you want. For example

    Object data[][] = {{"Hola", new Double(1.1)}, {"Otra fila", new Double(2.2)}};
    Object[] colsNames = {"String", "Double"};
    DefaultTableModel model = new DefaultTableModel(data, colsNames);
    JTable table = new JTable(model);
    
answered by 07.04.2017 в 09:33