public Component getTreeCellRendererComponent(JTree tree, Object value,
boolean selected, boolean expanded, boolean leaf, int row,
boolean hasFocus) {
Task task = (Task) ((DefaultMutableTreeNode) value).getUserObject();// getTask(value.toString());
if (task == null) {
return this;
}
int type = 0;
setFont(Fonts.GANTT_TREE_FONT);
if (task.isMilestone()) {
setIcon(new ImageIcon(getClass().getResource(
"/icons/meeting.gif")));
type = 1;
} else if (leaf) {
if (task.getPriority() == GanttTask.LOW) {
setIcon(new ImageIcon(getClass().getResource(
"/icons/task1.gif")));
} else if (task.getPriority() == GanttTask.NORMAL) {
setIcon(new ImageIcon(getClass().getResource(
"/icons/task.gif")));
} else if (task.getPriority() == GanttTask.HIGHT) {
setIcon(new ImageIcon(getClass().getResource(
"/icons/task2.gif")));
}
type = 2;
} else {
setIcon(new ImageIcon(getClass()
.getResource("/icons/mtask.gif")));
setFont(Fonts.GANTT_TREE_FONT2);
}
setText(task.toString());
setToolTipText(getToolTip(task, type));
setBackground(selected ? new Color((float) 0.290, (float) 0.349,
(float) 0.643) : row % 2 == 0 ? Color.white : new Color(
(float) 0.933, (float) 0.933, (float) 0.933));
setForeground(selected ? Color.white : Color.black);