怎么做一个无限的jscrollpane? [英] How do make an infinite jscrollpane?

查看:208
本文介绍了怎么做一个无限的jscrollpane?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

之前我已经实现了拖动滚动,但是创建无限滚动窗格的最佳方法是什么?当然不会有任何滚动条,我会实现拖动滚动。

I've implemented drag scroll before, but what's the best way to go about creating an infinite scroll pane? Of course there won't be any scrollbars and I will implement drag scroll.

我要做的是在无限的表面上实现动态加载。

What I am trying to do is implement dynamic loading on an infinite surface.

编辑

当然它实际上并不是无限的。我问的是如何伪造它。

Of course it wouldn't actually be infinite. I am asking how to fake it.

推荐答案

你可以做以下事情:

AdjustmentClass adj = new AdjustmentClass();
scrollPane.getHorizontalScrollBar().addAdjustmentListener(adj);
scrollPane.getVerticalScrollBar().addAdjustmentListener(adj);

在您的AdjustmentClass中执行以下操作:

And in your AdjustmentClass do the following:

public class AdjustmentClass implements AdjustmentListener {
    public void adjustmentValueChanged(AdjustmentEvent adjustmentEvent) {
        // Implement your custom code here
    }
}

要获得活动的方向,请执行以下操作:

To get orientation of the event do:

adjustmentEvent.getAdjustable().getOrientation();

您可以在以下位置找到方向常量:

You find the orientation constants in:

AdjustmentEvent.UNIT_INCREMENT
AdjustmentEvent.BLOCK_INCREMENT

等。等等。

要检查用户是否正在拖动滚动条旋钮,请执行以下操作:

To check if user is dragging the scroll-bar knob do:

adjustmentEvent.getValueIsAdjusting()

我还有更多信息,请查看API获取更多信息如果你需要的话。

There are i few more, check the API for more info if you need.

快乐的编码!

这篇关于怎么做一个无限的jscrollpane?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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