• Post Reply Bookmark Topic Watch Topic
  • New Topic

ToolTipText  RSS feed

Joe Myn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How can I show part of the contents of a file as a JTree node tooltip.

public class CustomTreeCellRenderer extends DefaultTreeCellRenderer

public CustomTreeCellRenderer()


public Component getTreeCellRendererComponent(JTree tree, Object value,
boolean selection, boolean expanded,
boolean leaf, int row, boolean hasFocus)
super.getTreeCellRendererComponent(tree, value, selection, expanded,
leaf, row, hasFocus);

DefaultMutableTreeNode node = (DefaultMutableTreeNode)value;

Object tooltip = node.getUserObject();

return this;



What is showing is the file name.
I need to display its contents.
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!