示例#1
0
 /** Print the table content */
 public void printTable() {
   for (int row = 0; row < dataTable.getRowCount(); ++row) {
     for (int col = 0; col < dataTable.getColumnCount(); ++col) {
       System.out.print("<>" + dataTable.getCell(row, col) + " ");
     }
   }
 }
示例#2
0
  /**
   * Check whether or not the cell exist
   *
   * @param value
   * @return true/false
   */
  public boolean doesCellValueExist(String value) {

    for (int row = 0; row < dataTable.getRowCount(); ++row) {
      for (int col = 0; col < dataTable.getColumnCount(); col++) {
        if (value.equals(getCell(row, col))) {
          return true;
        }
      }
    }
    return false;
  }
示例#3
0
  /**
   * return the value by key , for the table only contains 2 columns , the first column is regarded
   * as key column, and the second is value column
   *
   * @param key
   * @param val
   * @return
   */
  public boolean doesKeyValueExist(String key, String val) {

    for (int row = 0; row < dataTable.getRowCount(); ++row) {
      if (!key.equals(dataTable.getCell(row, 0))) {
        continue;
      } else {
        if (val.equals(dataTable.getCell(row, 1))) {
          return true;
        } else {
          return false;
        }
      }
    }
    return false;
  }
示例#4
0
  /** @return the row count of the table */
  public int getRowCount() {

    return dataTable.getRowCount();
  }