本文整理汇总了Java中com.google.gwt.user.client.ui.KeyboardListener.KEY_RIGHT属性的典型用法代码示例。如果您正苦于以下问题:Java KeyboardListener.KEY_RIGHT属性的具体用法?Java KeyboardListener.KEY_RIGHT怎么用?Java KeyboardListener.KEY_RIGHT使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类com.google.gwt.user.client.ui.KeyboardListener
的用法示例。
在下文中一共展示了KeyboardListener.KEY_RIGHT属性的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onKeyUp
private boolean onKeyUp(int p_keyCode)
{
boolean stopScroll = false;
switch( p_keyCode )
{
case KeyboardListener.KEY_DOWN:
case KeyboardListener.KEY_UP:
m_keyDragingY = 0;
stopScroll = true;
break;
case KeyboardListener.KEY_LEFT:
case KeyboardListener.KEY_RIGHT:
m_keyDragingX = 0;
stopScroll = true;
break;
default:
return true;
}
if( (stopScroll == true) && (m_keyDragingX == 0) && (m_keyDragingY == 0) )
{
fireScroll();
}
// cancel event
return false;
}
示例2: onKeyDown
private boolean onKeyDown(int p_keyCode)
{
switch( p_keyCode )
{
case KeyboardListener.KEY_DOWN:
if( m_keyDragingY != m_keyDraggingStep )
{
m_keyDragingY = m_keyDraggingStep;
m_keyDraggingTimer.cancel();
m_keyDraggingTimer.schedule( 1 );
}
return false;
case KeyboardListener.KEY_UP:
if( m_keyDragingY != -1 * m_keyDraggingStep )
{
m_keyDragingY = -1 * m_keyDraggingStep;
m_keyDraggingTimer.cancel();
m_keyDraggingTimer.schedule( 1 );
}
return false;
case KeyboardListener.KEY_LEFT:
if( m_keyDragingX != -1 * m_keyDraggingStep )
{
m_keyDragingX = -1 * m_keyDraggingStep;
m_keyDraggingTimer.cancel();
m_keyDraggingTimer.schedule( 1 );
}
return false;
case KeyboardListener.KEY_RIGHT:
if( m_keyDragingX != m_keyDraggingStep )
{
m_keyDragingX = m_keyDraggingStep;
m_keyDraggingTimer.cancel();
m_keyDraggingTimer.schedule( 1 );
}
// cancel event
return false;
default:
return true;
}
}
示例3: onMove
public void onMove(Element p_sender, int p_x, int p_y)
{
int scrollX = m_lastMouseX - p_x;
int scrollY = m_lastMouseY - p_y;
if( (m_isMouseDown) && (!m_isMouseDraging) )
{
if( (Math.abs( scrollX ) > m_mouseSensitivity) || Math.abs( scrollY ) > m_mouseSensitivity )
{
m_isMouseDraging = true;
m_maskPanel.setPixelSize( m_contentWidget.getOffsetWidth(), m_contentWidget
.getOffsetHeight() );
m_maskPanel.setVisible( true );
}
}
else if( m_isMouseDraging )
{
setScrollPositionSilent( getHorizontalScrollPosition() + scrollX, getVerticalScrollPosition()
+ scrollY );
m_lastMouseX = p_x;
m_lastMouseY = p_y;
}
else
{
int mouseScrollingKey = 0;
if( p_x > getOffsetWidth() - m_mouseArrowSpaceEast )
{
AbstractImagePrototype.create( Icons.s_instance.arrow_e() ).applyTo( m_mouseScrollingImage );
m_absPanel.setWidgetPosition( m_mouseScrollingImage, getOffsetWidth()
- m_mouseScrollingImage.getWidth(), p_y - m_mouseScrollingImage.getHeight() / 2 );
m_mouseScrollingImage.setVisible( true );
mouseScrollingKey = KeyboardListener.KEY_RIGHT;
}
else if( p_x < m_mouseArrowSpaceWest )
{
AbstractImagePrototype.create( Icons.s_instance.arrow_w() ).applyTo( m_mouseScrollingImage );
m_absPanel.setWidgetPosition( m_mouseScrollingImage, 0, p_y
- m_mouseScrollingImage.getHeight() / 2 );
m_mouseScrollingImage.setVisible( true );
mouseScrollingKey = KeyboardListener.KEY_LEFT;
}
else if( p_y > getOffsetHeight() - m_mouseArrowSpaceSouth )
{
AbstractImagePrototype.create( Icons.s_instance.arrow_s() ).applyTo( m_mouseScrollingImage );
m_absPanel.setWidgetPosition( m_mouseScrollingImage, p_x - m_mouseScrollingImage.getWidth()
/ 2, getOffsetHeight() - m_mouseScrollingImage.getHeight() );
m_mouseScrollingImage.setVisible( true );
mouseScrollingKey = KeyboardListener.KEY_DOWN;
}
else if( p_y < m_mouseArrowSpaceNorth )
{
AbstractImagePrototype.create( Icons.s_instance.arrow_n() ).applyTo( m_mouseScrollingImage );
m_absPanel.setWidgetPosition( m_mouseScrollingImage, p_x - m_mouseScrollingImage.getWidth()
/ 2, 0 );
m_mouseScrollingImage.setVisible( true );
mouseScrollingKey = KeyboardListener.KEY_UP;
}
else if( m_mouseScrollingKey != 0 )
{
m_mouseScrollingImage.setVisible( false );
m_mouseScrollingKey = 0;
}
DOM.setStyleAttribute( m_mouseScrollingImage.getElement(), "zIndex", "9999" );
if( (mouseScrollingKey != 0) && (m_keyDragingX == 0) && (m_keyDragingY == 0) )
{
m_mouseScrollingKey = mouseScrollingKey;
}
}
}