}
return tip;
}
+
+ /**
+ * Position the tooltip at the bottom edge of, and half way across, the
+ * current cell
+ */
+ @Override
+ public Point getToolTipLocation(MouseEvent e)
+ {
+ Point point = e.getPoint();
+ int column = table.columnAtPoint(point);
+ int row = table.rowAtPoint(point);
+ Rectangle r = getCellRect(row, column, false);
+ Point loc = new Point(r.x + r.width / 2, r.y + r.height);
+ return loc;
+ }
};
table.getTableHeader().setFont(new Font("Verdana", Font.PLAIN, 12));
table.setFont(new Font("Verdana", Font.PLAIN, 12));
/**
* Answers a suitable tooltip to show on the colour cell of the table
*
- * @param gcol
+ * @param fcol
* @return
*/
- public String getColorTooltip(FeatureColourI gcol)
+ public static String getColorTooltip(FeatureColourI fcol)
{
- if (gcol.isSimpleColour())
+ if (fcol == null)
{
- return BASE_TOOLTIP;
+ return null;
}
- StringBuilder tt = new StringBuilder();
- if (gcol.isAboveThreshold())
- {
- tt.append("Thresholded (Above ").append(gcol.getThreshold())
- .append(")");
- }
- else if (gcol.isBelowThreshold())
+ if (fcol.isSimpleColour())
{
- tt.append("Thresholded (Below ").append(gcol.getThreshold())
- .append(")");
- }
- else if (gcol.isColourByLabel())
- {
- tt.insert(0, "Coloured by label text ");
+ return BASE_TOOLTIP;
}
- tt.append("; ").append(BASE_TOOLTIP);
- return tt.toString();
+ String description = fcol.getDescription();
+ description = description.replaceAll("<", "<");
+ description = description.replaceAll(">", ">");
+ StringBuilder tt = new StringBuilder(description);
+ tt.append("<br>").append(BASE_TOOLTIP).append("</br>");
+ return JvSwingUtils.wrapTooltip(true, tt.toString());
}
public static void renderGraduatedColor(JLabel comp, FeatureColourI gcol,
button.setOpaque(true);
button.setBackground(me.getBackground());
button.setText(currentFilter.toString());
- button.setToolTipText(currentFilter.toString());
button.setIcon(null);
return button;
}