Java - how to add a listener in ImageJ plugin?

北慕城南 提交于 2019-12-11 06:16:57

问题


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.

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?

Link to the StackWindow class


回答1:


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.



来源:https://stackoverflow.com/questions/6735795/java-how-to-add-a-listener-in-imagej-plugin

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!