You might also want to use the Biojava FeatureTree class. An example of it's use is at http://www.biojava.org/docs/bj_in_anger/treeView.htm
- Mark Jacob Rohde <[EMAIL PROTECTED]> Sent by: [EMAIL PROTECTED] 07/31/2005 08:36 PM Please respond to Jacob Rohde To: biojava-l@biojava.org cc: (bcc: Mark Schreiber/GP/Novartis) Subject: [Biojava-l] Cast to Sequence Hi, I'm having a problem with a JTree and rendering of Sequences. Since the JTree calls toString() on objects when displaying them, I had to make my own TreeCellRenderer because the Sequence toString method prints out debug info. My code looks like this: public class FeatureTreeCellRenderer extends DefaultTreeCellRenderer { public Component getTreeCellRendererComponent(JTree tree, Object value, boolean sel, boolean expanded, boolean leaf, int row, boolean hasFocus) { JLabel l = (JLabel) super.getTreeCellRendererComponent(tree, value, sel, expanded, leaf, row, hasFocus); if(leaf) { System.out.println(value); Sequence s = (Sequence) value; l.setText(s.getName()); } return l; } } My problem is that I always get a ClassCastException. The weird thing is that the println method call above the cast clearly shows that the cast should be possible. This is the output of the pint statement: [EMAIL PROTECTED] name: DNA seq 0 And this is the exception: Exception in thread "AWT-EventQueue-0" java.lang.ClassCastException: javax.swing.tree.DefaultMutableTreeNode . etc. etc. I'm so confused. Any ideas? Thanks in advance, Jacob Rohde _______________________________________________ Biojava-l mailing list - Biojava-l@biojava.org http://biojava.org/mailman/listinfo/biojava-l _______________________________________________ Biojava-l mailing list - Biojava-l@biojava.org http://biojava.org/mailman/listinfo/biojava-l