コード例 #1
0
ファイル: JipViewer.java プロジェクト: pmahoney/melaza
  private void selectInAllMethods(JipMethod selectedMethod) {

    if (selectedMethod == null) {
      mMethods.clearSelection();
      return;
    }

    // which row should we select?
    boolean foundIt = false;
    int nRow = mAllMethodsModel.getRowCount();
    int iRow;
    for (iRow = 0; iRow < nRow; iRow++) {
      MethodRow scan = mAllMethodsModel.getRow(iRow);
      if (scan.getMethod().equals(selectedMethod)) {
        foundIt = true;
        break;
      }
    }
    if (!foundIt) {
      System.out.println("couldn't find " + selectedMethod.getName());
      return;
    }

    // update the listSelectionModel
    int iRowInView = mAllMethodsSorterModel.viewIndex(iRow);
    mMethods.getSelectionModel().setSelectionInterval(iRowInView, iRowInView);

    // scroll to contain the new selection
    Rectangle selectionRect = mMethods.getCellRect(iRowInView, 0, true);
    mMethods.scrollRectToVisible(selectionRect);
  }