@Override public Font getFont() { Font font = style.getFont(DefaultGraphNode.this); if (font == null) { font = DEFAULT_FONT; } return font; }
@Override public Paint getTextPaint() { Paint paint = style.getTextPaint(DefaultGraphNode.this); if (paint == null) { paint = Color.black; } return paint; }
Shape shape = style.getNodeShape(this, bounds); Paint bg = style.getBackgroundPaint(this); Paint borderPaint = style.getBorderPaint(this); Stroke borderStroke = style.getBorderStroke(this); addOverlayIcons(style.getOverlayIcons(this));
/** * @see javax.swing.JComponent#getToolTipText(java.awt.event.MouseEvent) */ public String getToolTipText(MouseEvent e) { String tooltipText = ""; if (e != null) { PNode pnode = getCamera().pick(e.getX(), e.getY(), 1).getPickedNode(); if (pnode.getVisible()) { if (pnode instanceof GraphNode && isShowNodeTooltips()) { GraphNode node = (GraphNode) pnode; tooltipText = node.getTooltip(); ttBackground = node.getNodeStyle().getTooltipBackgroundColor(); ttTextColor = node.getNodeStyle().getTooltipTextColor(); ttFont = node.getNodeStyle().getTooltipFont(); } else if (pnode instanceof GraphArc) { GraphArc arc = (GraphArc) pnode; tooltipText = arc.getTooltip(); if (tooltipText == null || tooltipText.equals("")) { tooltipText = arc.getSource().getText() + " ---" + arc.getType() + "---> " + arc.getDestination().getText(); } ttBackground = arc.getArcStyle().getTooltipBackgroundColor(); ttTextColor = arc.getArcStyle().getTooltipTextColor(); ttFont = arc.getArcStyle().getTooltipFont(); } } } return (tooltipText.length() > 0 ? " " + tooltipText + " " : ""); }
Point2D iconPosition = style.getOverlayIconPosition(this, icon); overlayIcon.setX(iconPosition.getX()); overlayIcon.setY(iconPosition.getY());