How can I create a tooltip when clicking on vertex in Jgraph?
I tried the following code, but the tooltip is not showing, although the MousePressed event is invoked.
ToolTipManager.sharedInstance().registerComponent(jgraph);
jgraph.addMouseListener(new MouseAdapter() {
public void mousePressed(MouseEvent e) {
if (e.getClickCount() == 2) {
int x = e.getX(), y = e.getY();
Object cell= jgraph.getFirstCellForLocation(x, y);
if (cell != null) {
String lab = jgraph.convertValueToString(cell);
jgraph.setToolTipText(lab);
System.out.println(lab);
}
}
}
});