Mark Schreiber wrote:
> Is it possibly time to change some of the toString() methods to give > more informative values (rather than a hashcode?). > > I say this because I was making a GUI using a JTree to display nested > Features. JTree automatically names nodes by their toString method. When > I tried to be cunning by returning the getName() method of a sequence as > a node I ran into the problem that my TreeModel, which was set up to > test for the number of leaves etc by first determining if the node was > an instanceof a FeatureHolder, sadly gave up the Ghost. > > Many such MCV components use the toString method so now that BioJava is > more mature I think we should fix this up. Actually a better design in this case, for gui work, is to create custom renderer components for biojava objects. For example, in a JTree that views features, use class FeatureTreeCellRenderer extends DefaultTreeCellRenderer { public Component getTreeCellRendererComponent(JTree tree, Object value, ...) { JLabel l = (JLabel) super.getTreeCellRendererComponent(tree,value,...); Feature f = (Feature) value; l.setText(f.getName()); return l; } } JTree tree = new JTree(); tree.setCellRenderer(new FeatureTreeCellRenderer()); or something similar. michael _______________________________________________ Biojava-l mailing list - [EMAIL PROTECTED] http://biojava.org/mailman/listinfo/biojava-l