Re: [Java-gnome-developer] JTable(Swing) to java-gnome
Brought to you by:
afcowie
From: Ka-Hing C. <ka...@gm...> - 2005-03-28 01:20:59
|
> I just started to work on a CustomTreeModel which would let you do > that. I am quite new to JNI and not sure if the whole thing would work > at all, I will let you know what I find out within the next week or > so. Attached is something that I hacked to together in a couple hours. Seems to work for a flat list with one column, didn't try anything more complex than that. Note that in order for the tree to display whatever's in the model, you still need to give it a renderer: /* NewStore is something that extends CustomTreeModel */ TreeView list = new TreeView(new NewStore()); TreeViewColumn col = new TreeViewColumn(); CellRendererText renderer = new CellRendererText(); list.appendColumn(col); col.packStart(renderer, true); col.setVisible(true); DataColumnString c = new DataColumnString(); // associate c with another model, but NOT NewStore, otherwise the next line // will complain col.addAttributeMapping(renderer, CellRendererText.Attribute.TEXT, c); Note that you will need to modify Makefile.am in order for those 2 files to build with java-gtk. -khc |