zoukankan      html  css  js  c++  java
  • lwuit调整滚动条灵敏度值

    Component类中:
            //设置滚动条灵敏度
            public void pointerReleased(int x, int y) {
            
    if (dragActivated) {
                
    long currentTime = System.currentTimeMillis();

                
    // replace x and y if this is an x scrolling container
                if (!isScrollableY()) {
                    y 
    = x;
                }

                
    if (currentTime != lastTime[(pLastDragged + lastTime.length + 1% lastTime.length]) {
                    lastTime[pLastDragged] 
    = System.currentTimeMillis();
                    lastDragged[pLastDragged] 
    = y;
                    pLastDragged 
    = (++pLastDragged) % lastTime.length;
                }
                
    float velocity = (float) (lastDragged[pLastDragged] - lastDragged[(pLastDragged + lastDragged.length + 1% lastDragged.length]) / (lastTime[pLastDragged] - lastTime[(pLastDragged + lastTime.length + 1% lastTime.length]);
                velocity 
    = velocity * -1;

           
    //默认为0.0004f ,越小灵敏度越高
                if (isScrollableY()) {
                    draggedMotion 
    = Motion.createFrictionMotion(scrollY, velocity, 0.0008f);
                } 
    else {
                    draggedMotion 
    = Motion.createFrictionMotion(scrollX, velocity, 0.0008f);
                }


                draggedMotion.start();
                dragActivated 
    = false;
            }
        }
  • 相关阅读:
    MS SQL SERVER导出表结构到Excel
    Ajax.ActionLink用法
    Layer弹出层关闭后刷新父页面
    Ajax.BeginForm提示不支持live属性或方法的错误
    BootStrap带样式打印
    利用JQuery jsonp实现Ajax跨域请求 .Net 的*.handler 和 WebService,返回json数据
    Bootstrap打印问题
    EF的表左连接方法Include和Join
    vs code的local history插件
    idea debug的drop frame,set watch和设置过滤条件
  • 原文地址:https://www.cnblogs.com/datong/p/1542594.html
Copyright © 2011-2022 走看看