more fails incoming.
Here a new class
public class JuserMatchData extends JTable implements TableCellRenderer {
public DefaultTableModel tableModel;
public static DefaultTableColumnModel columnModel;
public static TableColumn[] col = new TableColumn [4];
static {
columnModel = new DefaultTableColumnModel();
/* edit TableColumn and add to static columnModel */
}
JuserMatchData(){ //only head, for title
super( new DefaultTableModel( ), columnModel);
tableModel = (DefaultTableModel) super.getModel();
}
JuserMatchData(user u){ //only body, for users
super( new DefaultTableModel( ), columnModel);
tableModel = (DefaultTableModel) super.getModel();
//HOW can i remove title?
tableModel.addRow(new Object[]{"IdL", "Sfid", "Gir", "Stat"});
}
@Override
public Component getTableCellRendererComponent(JTable arg0, Object arg1,
boolean arg2, boolean arg3, int arg4, int arg5) {
return this;
}
}
Now, in the code pasted in my first post i can replace the row
col[2].setHeaderValue(new JTable(3, 1));
// with
col[2].setHeaderValue(new JuserMatchData());
Here the result
java.JPG
(for testing purpose i placed a table even in the normal cell )
If i add
col[2].setCellRenderer(new JuserMatchData());
col[2].setHeaderValue(new JuserMatchData());
i have this result
java.JPG
If i undo and i add
JUsers.setDefaultRenderer(JuserMatchData.class, new JuserMatchData()); //JUsers is the table posted
//or
JUsers.setDefaultRenderer(JTable.class, new JuserMatchData());
i have no changes, and i see the table like a string, like before.
Thanks for helps
PS:did u realized that i have to make 4 obj for my 4 column into an obj for the columnModel that, with an object for the tableModel, make my smaller table (class that implements TableCellRenderer and extend JTable) placed into the title of another TableColumn that is into a tableColumnModel that make another JTable (with its tableModel, ofc). Is theren't an easier way?