Insert JTable into JXTreeTable

125 views Asked by At

I have a JXTreeTable where each row should be a name, a JTable with some saved data and a Save JButton. I am having problem displaying properly the tables and buttons. I have overridden the getColumnClass:

        model = new DefaultTreeTableModel(root, Arrays.asList(headings)) {

        @Override
        public Class getColumnClass(int column) {
            if (column == 1) {
                return JTable.class;
            } else if (column == 3) {
                return JButton.class;
            } else {
                return String.class;
            }
        }
    };

but the tables appear as a description of their characteristics:

userTable$2[,0,0,0x0,invalid,alignmentX=0.0,alignmentY=0.0,border=,flags=251658568,maximumSize=,minimumSize=,preferredSize=,autoCreateColumnsFromModel=true,autoResizeMode=AUTO_RESIZE_SUBSEQUENT_COLUMNS,cellSelectionEnabled=false,editingColumn=-1,editingRow=-1,gridColor=javax.swing.plaf.ColorUIResource[r=128,g=128,b=128],preferredViewportSize=java.awt.Dimension[width=450,height=400],rowHeight=16,rowMargin=1,rowSelectionAllowed=true,selectionBackground=javax.swing.plaf.ColorUIResource[r=51,g=153,b=255],selectionForeground=javax.swing.plaf.ColorUIResource[r=255,g=255,b=255],showHorizontalLines=true,showVerticalLines=true]

Is there a specific way I should insert the JTable as cell data? Thank you for your help!

0

There are 0 answers