如何做到平滑滚动在摇摆名单 [英] How to do smooth scrolling for lists in Swing

查看:284
本文介绍了如何做到平滑滚动在摇摆名单的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在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屋!

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