滚动事件的JScrollPane [英] Scroll Event of a JScrollPane

查看:244
本文介绍了滚动事件的JScrollPane的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

奇怪的是, JScrollPane 没有方法 addAdjustmentListener()。但是AdjustListener据说与滚动条一起使用。每当 JScrollPane 以任一方式滚动时,我想要发生事情。如何实现这样的事情?

It's strange that JScrollPane doesn't have a method addAdjustmentListener(). Yet adjustmentListener is said to be used with scrollbars. I want something to happen whenever the JScrollPane is scrolled in either way. How to achieve such a thing?

推荐答案

为什么不能获得实际的滚动条,然后添加调整监听器? JScrollBar 有一个名为 addAdjustmentListener()的方法。

Why don't you get the actual scrollbars, and then add adjustment listeners to them? JScrollBar has a method called addAdjustmentListener().

您可以使用 getVerticalScrollBar() getHorizo​​ntalScrollBar()获取一个 JScrollBar JScrollPane

And you can use getVerticalScrollBar() and getHorizontalScrollBar() to get a JScrollBar from a JScrollPane

这篇关于滚动事件的JScrollPane的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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