当前位置: 首页>>代码示例>>Java>>正文


Java KeyboardListener.KEY_RIGHT属性代码示例

本文整理汇总了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;
}
 
开发者ID:kroc702,项目名称:fullmetalgalaxy,代码行数:25,代码来源:WgtScroll.java

示例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;
  }
}
 
开发者ID:kroc702,项目名称:fullmetalgalaxy,代码行数:41,代码来源:WgtScroll.java

示例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;
    }
  }
}
 
开发者ID:kroc702,项目名称:fullmetalgalaxy,代码行数:68,代码来源:WgtScroll.java


注:本文中的com.google.gwt.user.client.ui.KeyboardListener.KEY_RIGHT属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。