Mouse over and mouse away

I am using JGoTextNode. I would like to update my node on mouse
over and mouse away. I overwrite doUncapturedMouseMove
for mouse over behavior. How do I listen for mouse away so that I
can toggle my icon back to normal.

You can override JGoView.doUncapturedMouseMove. Call the super method, and call pickDocObject(dc, false).
If it returns null, the mouse isn’t over any document object, and you can toggle your icon, for which presumably you have kept a reference in some field you have added to the view.

Where is pickDocObject(dc, false)? I only see pickObject(dc, false).
Anyways, your solution is not working.

Yes, that should work.
You will probably want to wrap your JGoObject-modifying code for “toggling” its appearance in calls to setSkipsUndoManager:
public boolean isHighlit() {
return (getBorder() != null && getBorder().getPen() == myHighlightPen);
public void setHighlit(boolean lit) {
if (getBorder() != null) {
if (lit)

Hi Walter,
Thanks! It works.
I noticed that in my JGoTextNode, the text in the botton part has
an appearance of a button (grey color) and text on top. I would like
to make it transparent so that it is the same color as that of the
canvas. How is this possible?
The link between nodes is between the text labels. I would like the
connecting points to be at half the height of the JGoTextNode
((node image height + bottom label height) / 2). How is this possible?

For a transparent background: JGoTextNode.setBrush(null)
For the last question, I don’t understand what you want to do. Perhaps you just want to reposition the JGoPorts that the links connect? By default they are positioned in the middle of each of the four sides of the rectangular bounds given by the JGoTextNode.getBackground() object.
You could override layoutChildren to position them elsewhere, if you like. There’s an example of this for a particular port in, in the FamilyTree example. You can also look at the many other examples of overriding JGoArea.layoutChildren in the examples.

HI Walter,
I notice that in the toPort, the arrow head of the link is partially
covered by the node image. Is is possible to make the link shorter to avoid this?

There are lots of possibilities, but I don’t know which circumstance you are talking about.
You could change the size and/or position of the port.
You could change the size (width or length) of the arrowhead.
It all depends on what kind of node you have, what kinds of ports you have, what kinds of links you have, and how they are being used.

This is a JGoTextNode. I do
getRightPort().setSpotLocation(CenterLeft, back, CenterRight);
getLeftPort().setSpotLocation(CenterLeft, back, CenterLeft);
Now the link is from label to label between 2 nodes. I would like the
link to move up so that its from the middle of the node to the middle
of the second node.

So you are positioning the left port to be on the inside of the background, and the right port to be on the outside of the background. Is that what you wanted?
What do you mean by having the link “move up”? It sounds like you want the ports to be at the center of the node. But that would definitely cause the links to cross over the background and the text label.

How do I attach an image to this topic?

I have 2 JGoTextNodes:
--------- &nb sp; &nb sp; &nb sp; ----------
| &nbsp ; | ---------- ----- > | |
---------- &n bsp; &n bsp; ----------
Node A -----------------> No de B
By “move up”, I mean changing the arrow position “up” so that
link is from node icon to node icon and not from label to label.

Did you override layoutChildren to position the background shape above (i.e. at a smaller Y coordinate) the text label? It looks like it. Although if you simply modified the rectangle’s position, your arrangement will be lost as soon as the text changes–which is why you should override layoutChildren.
If so, in your override of layoutChildren you also need to position the ports where you want them to be.

Thanks Walter. I have figured this out.