Java - 如何在 ImageJ 插件中添加侦听器? [英] Java - how to add a listener in ImageJ plugin?

查看:52
本文介绍了Java - 如何在 ImageJ 插件中添加侦听器?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在为 ImageJ 编写一个插件,该插件在 AVI 视频中的一系列帧上扫描所需线条的像素以获得亮度.活动视频帧的数据以二维图形显示,x 轴上的像素和 y 轴上的强度.

I am writing a plugin for ImageJ that scans the pixels of a desired line for brightness over a series of frames in an AVI video. The data is displayed in 2D graph for the active video frame, pixels on the x-axis and intensity on the y-axis.

我希望图形自行更新以显示 StackWindow 中活动帧的数据(显示帧的位置).这是由窗口中的滑块控制的.我查看了这个并找到了关于 AdjustmentListener 类的信息,我可能可以用它来检查滑块何时调整.我该怎么做?

I want the graph to update itself to show the data for the active frame in the StackWindow (Where the frame is displayed). This is controlled by the slider in the window. I looked into this and found information on the AdjustmentListener class, which I can probably use to check when the slider is adjusted. How do I do this?

链接到 StackWindow 类

Link to the StackWindow class

推荐答案

据我所知,没有一种特别优雅的方式来做到这一点.最好的方法可能是遍历 getComponents 在您的 StackWindow 上返回的所有内容,如果它是 Scrollbar,则向该组件添加一个 AdjustmentListener.你可以找到几个例子 这里此处,尽管这些示例比您需要的更通用.

As far as I know there isn't a particularly elegant way of doing this. The best way is probably to iterate over everything returned by getComponents on your StackWindow and add an AdjustmentListener to that component if it's a Scrollbar. You can find a couple of examples here and here, although those examples are more general than what you need.

这篇关于Java - 如何在 ImageJ 插件中添加侦听器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆