Thread: [Java-gnome-developer] Strange error mesage when using treeView
Brought to you by:
afcowie
From: Kyrre N. S. <ky...@so...> - 2006-06-22 09:24:34
|
I just wrote up some code to present the channellist in givtv, following the treeView tutor quite closely. But when i try to run it, i get this backtrace, and i don't know what it means: *********** START BACKTRACE ****************** java.lang.Exception: gtk_tree_view_column_cell_layout_add_attribute: assertion `info != NULL' failed at org.gnu.glib.GObject.printStackTrace(GObject.java:675) at org.gnu.gtk.TreeViewColumn.addAttributeMapping(TreeViewColumn.java:387) at net.sourceforge.givtv.gnomeFrontend.MainWindow.setupTreeView(MainWindow.java:143) at net.sourceforge.givtv.gnomeFrontend.MainWindow.createView(MainWindow.java:63) at net.sourceforge.givtv.gnomeFrontend.MainWindow.<init>(MainWindow.java:35) at net.sourceforge.givtv.gnomeFrontend.Givtv.<init>(Givtv.java:41) at net.sourceforge.givtv.gnomeFrontend.Givtv.main(Givtv.java:57) Exception in thread "main" java.lang.NullPointerException at net.sourceforge.givtv.gnomeFrontend.MainWindow.populateChannels(MainWindow.java:121) at net.sourceforge.givtv.gnomeFrontend.MainWindow.<init>(MainWindow.java:36) at net.sourceforge.givtv.gnomeFrontend.Givtv.<init>(Givtv.java:41) at net.sourceforge.givtv.gnomeFrontend.Givtv.main(Givtv.java:57) *********** END BACKTRACE ****************** This is the offending part of MainWindow.java: private void setupTreeView () { //Setup the backend storage //DataColumn[] columns = new DataColumnString[1]; datacolumn0 = new DataColumnString (); channellist = new ListStore(new DataColumn[] {datacolumn0}); channellistWidget.setModel(channellist); //Setup the visual appearance of the treeView TreeViewColumn col0 = new TreeViewColumn (); CellRendererText render0 = new CellRendererText (); col0.setTitle("Channel name"); col0.addAttributeMapping(render0, CellRendererText.Attribute.TEXT, datacolumn0); ----****----> channellistWidget.appendColumn(col0); <---- Line 143 //General setup of the widget channellistWidget.setEnableSearch(true); channellistWidget.setAlternateRowColor(true); channellistWidget.setHeadersVisible(false); } What does it mean? I don't understand... Just say so if you need more code! Its all GPL, so it isn't any problem :) |
From: Andrew C. <an...@op...> - 2006-06-22 11:17:05
|
On Thu, 2006-06-22 at 11:24 +0200, Kyrre Ness Sjobak wrote: > TreeViewColumn col0 = new TreeViewColumn(); > CellRendererText render0 = new CellRendererText(); > col0.setTitle("Channel name"); > col0.addAttributeMapping(render0, CellRendererText.Attribute.TEXT, datacolumn0); No biggie. You missed out a step. You have to pack the CellRenderer into the TreeViewColumn. Add something like col0.packStart(render0, true) evidently before you call the TreeView's appendColumn(). [I was actually under the impression that you had to call it before you call the TreeViewColumn's addAttributeMapping(). Do let me know if that's the case] > What does it mean? I don't understand... Errors like that bubbling out of GTK are usually because you're using it improperly. Over time, I hope we can catch this sort of thing at the Java layer before passing down through JNI to the C GTK library. For now, we should certainly update the javadoc a bit! > Its all GPL, so it isn't any problem :) Good show. AfC Sydney -- Andrew Frederick Cowie Technology strategy, managing change, establishing procedures, and executing successful upgrades to mission critical business infrastructure. http://www.operationaldynamics.com/ Sydney New York Toronto London |
From: Kyrre N. S. <ky...@so...> - 2006-06-22 11:30:42
|
Yeah, i found out. Annother angel on the list was at my mailbox before you :) I changed the code to: private void setupTreeView () { //Setup the backend storage //DataColumn[] columns = new DataColumnString[1]; datacolumn0 = new DataColumnString (); channellist = new ListStore(new DataColumn[] {datacolumn0}); channellistWidget.setModel(channellist); //Setup the visual appearance of the treeView TreeViewColumn col0 = new TreeViewColumn (); CellRendererText render0 = new CellRendererText (); col0.packStart(render0, true); col0.setTitle("Channel name"); col0.addAttributeMapping(render0, CellRendererText.Attribute.TEXT, datacolumn0); channellistWidget.appendColumn(col0); //General setup of the widget channellistWidget.setEnableSearch(true); channellistWidget.setAlternateRowColor(true); channellistWidget.setHeadersVisible(false); } And now it works :) --- Kyrre tor, 22.06.2006 kl. 13.16 skrev Andrew Cowie: > On Thu, 2006-06-22 at 11:24 +0200, Kyrre Ness Sjobak wrote: > > > TreeViewColumn col0 = new TreeViewColumn(); > > CellRendererText render0 = new CellRendererText(); > > col0.setTitle("Channel name"); > > col0.addAttributeMapping(render0, CellRendererText.Attribute.TEXT, datacolumn0); > > No biggie. You missed out a step. You have to pack the CellRenderer into > the TreeViewColumn. Add something like > > col0.packStart(render0, true) > > evidently before you call the TreeView's appendColumn(). > > [I was actually under the impression that you had to call it before you > call the TreeViewColumn's addAttributeMapping(). Do let me know if > that's the case] > > > What does it mean? I don't understand... > > Errors like that bubbling out of GTK are usually because you're using it > improperly. Over time, I hope we can catch this sort of thing at the > Java layer before passing down through JNI to the C GTK library. For > now, we should certainly update the javadoc a bit! > > > Its all GPL, so it isn't any problem :) > > Good show. > > AfC > Sydney |