vom aus sehen will ich es so
http://img90.imageshack.us/img90/6175/jxtreetable.jpg
ich habe dazu einen eigenes TableColumnModel geschrieben
nur leider hat das Teil dann ein Problem wenn ich den letzten Knoten schließe
[HIGHLIGHT="Java"]public class TreeTableColumnModel extends DefaultTableColumnModelExt{
private static final long serialVersionUID = -460564269970113310L;
private int[] savedWidth = null;
public TreeTableColumnModel(){
super();
if( null != table ){
for(int i = 0; i < table.getColumnCount(); i++){
this.addColumn(new TableColumnExt(i));
}}}
public TableColumn getColumn(int columnIndex){
TableColumn tc = super.getColumn(columnIndex);
TreePath tp = table.getPathForRow(aktCellRectRow);
Object op = null;
aktTreeNode = null;
if( null != tp ){
op = tp.getLastPathComponent();
if( op instanceof Node){
aktTreeNode = (TreeNode) op;
}}
if( null != aktTreeNode && aktTreeNode.isLeaf() != true){
saveWidth();
if ( columnIndex == 0) tc.setWidth(getWithTotal());
else tc.setWidth(0);
}
else{restoreWidth(); }
return tc;
}
private int getWithTotal(){
if ( null == savedWidth) return -1;
int width = 0;
for ( int i = 0; i < savedWidth.length; ++i){
width += savedWidth[ i ];}
return width;
}
private void saveWidth(){
if ( savedWidth != null ) return;
savedWidth = new int[super.getColumnCount()];
for ( int i = 0; i < super.getColumnCount(); ++i){
TableColumn tc = super.getColumn(i);
savedWidth[ i ] = tc.getWidth();
}
}
private void restoreWidth(){
if ( savedWidth == null) return;
for ( int i = 0; i < super.getColumnCount(); ++i){
TableColumn tc = super.getColumn(i);
tc.setWidth(savedWidth[ i ]);
}
savedWidth = null;
}
}[/HIGHLIGHT]