I need to highlight a link, and some of the text in the ShapeNode I am using to label the link. Ideally this highlight should be highly visible, but temporary - not being stored, but only changing/disappearing when I deliberately remove/change them. I am currently trying to do this by setting text and lines to RED.
To highlight the link I am using the following code:
if( setHighlight )
{
Pen pen = (Pen)diagramLink.getEffectivePen().clone();
pen.setColor( Color.RED );
pen.setWidth( 3.0f );
diagramLink.setHeadPen( pen );
diagramLink.setPen(pen);
}
This doesn't always seem to work as expected. The 'line' of the link, and outline of the arrowhead always get much thicker, but don't always go red. Even when they do go red, the colour disappears after a few moments even though I have done nothing with the application in the meantime. The lines remain thicker.
Am I changing the line colour in the 'correct' way? Why would I loose colour but not thickness when I am setting them together?
I also change the colour of some of the text in the ShapeNode I am using as the label for the link (attached via the subordinate group of the link), and this change in text colour 'reverts' after a few moments too.
I am doing the same thing with my 'normal' Nodes, and am not having any problems with them at all.
Do DiagramLinks and their subordinate Nodes get updated automatically for any reason?