Code example for JLabel

Methods: setToolTipTextgetTextsetText

0
			boolean selected, boolean expanded, boolean leaf, int row,
			boolean hasFocus) {
		 
		JLabel treeCellRendererComponent = (JLabel) super.getTreeCellRendererComponent( tree, value, selected, expanded, leaf, row, hasFocus );
		 
		String text = treeCellRendererComponent.getText();
		String tooltip = null;
		if(value instanceof Statistics) {
			Statistics stats = (Statistics) value;
			text = "Statistics " + formatter.format( new Date(stats.getStartTime()) );
			tooltip = stats.toString();
		} 
		 
		if(value instanceof CategorizedStatistics) {
			CategorizedStatistics stats = (CategorizedStatistics) value;
			text = stats.getCategoryName();
			 
		} 
		if(value instanceof EntityStatistics) {
			//EntityStatistics stats = (EntityStatistics) value; 
			 
		} 
		 
		if(value instanceof CollectionStatistics) {
			//CollectionStatistics stats = (CollectionStatistics) value; 
			 
		} 
		 
		if(value instanceof QueryStatistics) {
			//QueryStatistics stats = (QueryStatistics) value; 
		 
		} 
		 
		treeCellRendererComponent.setText( text );
		treeCellRendererComponent.setToolTipText( tooltip );
		return treeCellRendererComponent;
	} 
 
	 
} 
Experience pair programming with AI  Get Codota for Java