コード例 #1
0
ファイル: JX2Table.java プロジェクト: hdijkema/JSplitTable
 public void scrollToRowCol(int row, int col, JScrollPane pane) {
   Dimension d = pane.getViewport().getSize();
   Rectangle R = super.getCellRect(row, col, true);
   Rectangle E = super.getCellRect(super.getModel().getRowCount() - 1, col, true);
   int H = d.height / 2;
   if (R.y - H > 0 && R.y + H < E.y) {
     R.y -= H;
     R.height = d.height;
   }
   super.scrollRectToVisible(R);
 }
コード例 #2
0
  public void propertyChange(PropertyChangeEvent event) {
    String prop = event.getPropertyName();

    if (prop.equalsIgnoreCase(SequiturMessage.MAIN_CHART_CLICKED_MESSAGE)) {
      String rule = (String) event.getNewValue();
      System.out.println("CombinedRulesPanel.propertyChange.rule:     " + rule);
      for (int row = 0; row <= combinedRulesTable.getRowCount() - 1; row++) {
        for (int col = 0; col <= combinedRulesTable.getColumnCount() - 1; col++) {
          if (rule.equals(
              chartData.convert2OriginalSAXAlphabet(
                  '1', combinedRulesTable.getValueAt(row, col).toString()))) {
            combinedRulesTable.scrollRectToVisible(combinedRulesTable.getCellRect(row, 0, true));
            combinedRulesTable.setRowSelectionInterval(row, row);
          }
        }
      }
    }
  }