Hi,all
I am replant the example “annotatePick.tcl” using Java. But I don’t how to use the method “AddObserver” in java.
“AddObserver” method has three parameters. In C++, we can carry a function pointer as the second parameter, but in “vtkObject.java”, the method defined as follow:
public native int AddObserver(String id0, Object id1, String id2);
so what can I do to translate the real parameter to the second formal parameter?
The script of annotatePick.tcl as follow:
………………….
# Create a cell picker.
vtkCellPicker picker
picker AddObserver EndPickEvent annotatePick
………………….
# Create a Tcl procedure to create the text for the text mapper used to
# display the results of picking.
proc annotatePick {} {
if { [picker GetCellId] < 0 } {
        textActor VisibilityOff
} else {
        set selPt [picker GetSelectionPoint]
        set x [lindex $selPt 0]
        set y [lindex $selPt 1]
        set pickPos [picker GetPickPosition]
        set xp [lindex $pickPos 0]
        set yp [lindex $pickPos 1]
        set zp [lindex $pickPos 2]
        textMapper SetInput "($xp, $yp, $zp)"
        textActor SetPosition $x $y
        textActor VisibilityOn
}
renWin Render
}
Thanks in advance.
<br><br>
<hr align="left" width="577" size="1" color="cccccc">
<table cellpadding="1" cellspacing="1" border="0" >
<tr>
<td style="font-size: 14px"><a href="http://sms1.ctn.com.cn/ivr/usms_ivr_free_song_01_1_0.htm?user_id=3&code_id=w006" target="_blank"><font color="red">劲歌、金曲,流行、怀旧 免费随你点!!!</font></a></td>
</tr>
<tr>
<td style="font-size: 14px"><a href="http://card.tom.com/catalog/120/" target="_blank">中秋赏明月,温馨寄祝福!TOM贺卡站</a></td>
</tr>
<tr>
<td nowrap style="font-size: 14px"><a href="http://mp3.tom.com/" target="_blank"><font color="#ff0000">150万最新最全MP3歌曲免费下载!</font></a></td>
</tr>
<!--tr>
<td style="font-size: 14px"><a href="http://search.tom.com/mp3/" target="_blank">送你10万首MP3金曲,点此下载</a></td>
</tr-->
</table>
<table cellpadding="1" cellspacing="1" border="0" style="margin-top:10px;">
<tr>
<td nowrap style="font-size: 14px"><a href="http://vip.163.net" target="_blank"><font color="#ff0000"> 163收费邮箱无条件全面升级,升幅强劲,加量不加价!<br>
更强安全系统,更大容量!一样的价格,不一样的空间!</font></a></td>
</tr>
<tr>
<td nowrap style="font-size: 14px"><a href="http://vip.163.net" target="_blank"><font color="#000000"> 邮箱订购及咨询热线(24小时):8008309163 或 020-87324711</font></a></td>
</tr>
</table>