使用键t和b滚动屏幕

习惯上,BlackBerry UI程序中,如果用户按下了键t,屏幕应该自动滚动到最前面(top);如果用户按下了键b,屏幕应该自动滚动到最前面(bottom)。这个效果其实在Screen中很容易实现。

protected boolean keyChar(char key, int status, int time) { boolean retVal = false; if(key == Characters.LATIN_SMALL_LETTER_T){ getMainManager().setVerticalScroll(0); retVal = true; } if(key == Characters.LATIN_SMALL_LETTER_B){ Manager mm = getMainManager(); getMainManager().setVerticalScroll(Math.max(0, mm.getVirtualHeight() - mm.getVisibleHeight())); retVal = true; } return retVal; }

你可能感兴趣的:(BlackBerry,Java)