コード例 #1
0
  private void loadBuildingCombo() throws Exception {
    bDB.getBuildingList(buildingComboList);
    DefaultComboBoxModel cboBuildingModel = (DefaultComboBoxModel) cboBuilding.getModel();
    for (KeyValue kv : buildingComboList) {
      cboBuildingModel.addElement(kv);
    }
    cboBuilding.setModel(cboBuildingModel);

    cboBuilding.addItemListener(
        new java.awt.event.ItemListener() {
          @Override
          public void itemStateChanged(java.awt.event.ItemEvent evt) {
            if (evt.getStateChange() == ItemEvent.SELECTED) {
              setComboUnit();
            }
          }
        });
  }
コード例 #2
0
  // METHODS for SEARCHING / RELOADING THE SEARCH VALUE
  public void loadTable() {
    try {
      model.getDataVector().removeAllElements();
      model.fireTableDataChanged();

      b.searchBuildingList(txtSearch.getText().trim().replaceAll("'", ""), buildingList);
      if (buildingList.isEmpty()) {
        Message.showWarning("Record not Found");
        txtSearch.requestFocus();
        return;
      }
      for (Object[] obj : buildingList) {
        model.addRow(obj);
      }
      if (model.getRowCount() > 0) {
        tblBuildingList.requestFocus();
        tblBuildingList.setRowSelectionInterval(0, 0);
      }
    } catch (Exception e) {
      Message.showError(e.getMessage());
    }
  }