當前位置: 首頁>>代碼示例>>Java>>正文


Java SWT.HOME屬性代碼示例

本文整理匯總了Java中org.eclipse.swt.SWT.HOME屬性的典型用法代碼示例。如果您正苦於以下問題:Java SWT.HOME屬性的具體用法?Java SWT.HOME怎麽用?Java SWT.HOME使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在org.eclipse.swt.SWT的用法示例。


在下文中一共展示了SWT.HOME屬性的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: cursorMoved

/**
 * Tests if a given key event may move the current cursor position.
 * @param event the key event
 * @return <code>true</code> if the key event may move the current cursor position, otherwise <code>false</code>
 */
private boolean cursorMoved(Event event) {
    final int key = (SWT.KEY_MASK & event.keyCode);
    switch (key) {
        case SWT.ARROW_DOWN:
        case SWT.ARROW_LEFT:
        case SWT.ARROW_RIGHT: 
        case SWT.ARROW_UP: 
        case SWT.HOME:
        case SWT.END: 
        case SWT.PAGE_DOWN:
            return true;
    }
    return false;
}
 
開發者ID:liaoziyang,項目名稱:ContentAssist,代碼行數:19,代碼來源:DocumentManager.java

示例2: onKeyDown

protected void onKeyDown(KeyEvent e) {
  boolean focusChanged = false;
  int newFocusRow = m_FocusRow;
  int newFocusCol = m_FocusCol;

  if (m_Model == null)
    return;

  if ((e.character == ' ') || (e.character == '\r')) {
    openEditorInFocus();
    return;
  } else if (e.keyCode == SWT.HOME) {
    newFocusCol = m_Model.getFixedColumnCount();
    if (newFocusRow == -1)
      newFocusRow = m_Model.getFixedRowCount();
    focusChanged = true;
  } else if (e.keyCode == SWT.END) {
    newFocusCol = m_Model.getColumnCount() - 1;
    if (newFocusRow == -1)
      newFocusRow = m_Model.getFixedRowCount();
    focusChanged = true;
  } else if (e.keyCode == SWT.ARROW_LEFT) {
    if (!m_RowSelectionMode) {
      if (newFocusCol > m_Model.getFixedColumnCount())
        newFocusCol--;
    }
    focusChanged = true;
  } else if (e.keyCode == SWT.ARROW_RIGHT) {
    if (!m_RowSelectionMode) {
      if (newFocusCol == -1) {
        newFocusCol = m_Model.getFixedColumnCount();
        newFocusRow = m_Model.getFixedRowCount();
      } else if (newFocusCol < m_Model.getColumnCount() - 1)
        newFocusCol++;
    }
    focusChanged = true;
  } else if (e.keyCode == SWT.ARROW_DOWN) {
    if (newFocusRow == -1) {
      newFocusRow = m_Model.getFixedRowCount();
      newFocusCol = m_Model.getFixedColumnCount();
    } else if (newFocusRow < m_Model.getRowCount() - 1)
      newFocusRow++;
    focusChanged = true;
  } else if (e.keyCode == SWT.ARROW_UP) {
    if (newFocusRow > m_Model.getFixedRowCount())
      newFocusRow--;
    focusChanged = true;
  } else if (e.keyCode == SWT.PAGE_DOWN) {
    newFocusRow += m_RowsVisible - 1;
    if (newFocusRow >= m_Model.getRowCount())
      newFocusRow = m_Model.getRowCount() - 1;
    if (newFocusCol == -1)
      newFocusCol = m_Model.getFixedColumnCount();
    focusChanged = true;
  } else if (e.keyCode == SWT.PAGE_UP) {
    newFocusRow -= m_RowsVisible - 1;
    if (newFocusRow < m_Model.getFixedRowCount())
      newFocusRow = m_Model.getFixedRowCount();
    if (newFocusCol == -1)
      newFocusCol = m_Model.getFixedColumnCount();
    focusChanged = true;
  }

  if (focusChanged) {

    focusCell(newFocusCol, newFocusRow, e.stateMask);

    if (!isCellFullyVisible(m_FocusCol, m_FocusRow))
      scrollToFocus();
  }
}
 
開發者ID:convertigo,項目名稱:convertigo-eclipse,代碼行數:71,代碼來源:KTable.java


注:本文中的org.eclipse.swt.SWT.HOME屬性示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。