如何做到平滑滚动在摇摆名单 [英] How to do smooth scrolling for lists in Swing
问题描述
在iPhone上滚动列表顺利动画。忽略惯性作用(尽管有这将是冷静为好) - 我怎么会去制作一个Swing列表框的滚动顺畅像
On the iPhone scrolling through lists is animated smoothly. Ignoring the inertia effect (though having it would be cool as well) - how would I go about making a Swing listbox scroll smoothly like that?
有其他的例子还有,比如浏览器,但那些使用它,我不能与Swing使用本机的控制。
There are other examples as well, like browsers, but those use native controls which I cannot use with Swing.
推荐答案
如果您使用的是 JList的
尽量覆盖 getScrollableUnitIncrement(矩形,INT,INT )
和 getScrollableBlockIncrement(矩形,INT,INT)
返回定制递增..如: 2个像素,而不是默认值从列表项的高度来计算。
If you are using JList
try overwrite getScrollableUnitIncrement(Rectangle, int, int)
and getScrollableBlockIncrement(Rectangle, int, int)
to return custom increment .. e.g. 2 pixels instead of default values computed from list entry height.
这篇关于如何做到平滑滚动在摇摆名单的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!