예제 #1
0
 private void updateTable(List list, final DefaultTableModel dftm) {
   int num = dftm.getRowCount();
   for (int i = 0; i < num; i++) dftm.removeRow(0);
   Iterator iterator = list.iterator();
   TbKhinfo khInfo;
   while (iterator.hasNext()) {
     List info = (List) iterator.next();
     Item item = new Item();
     item.setId((String) info.get(0));
     item.setName((String) info.get(1));
     khInfo = Dao.getKhInfo(item);
     Vector rowData = new Vector();
     rowData.add(khInfo.getId().trim());
     rowData.add(khInfo.getKhname().trim());
     rowData.add(khInfo.getAddress().trim());
     rowData.add(khInfo.getJian().trim());
     rowData.add(khInfo.getBianma().trim());
     rowData.add(khInfo.getTel().trim());
     rowData.add(khInfo.getFax().trim());
     rowData.add(khInfo.getLian().trim());
     rowData.add(khInfo.getLtel().trim());
     rowData.add(khInfo.getMail().trim());
     rowData.add(khInfo.getXinhang().trim());
     rowData.add(khInfo.getHao().trim());
     dftm.addRow(rowData);
   }
 }
예제 #2
0
 public void actionPerformed(final ActionEvent e) {
   String condition, conditionOperation, conditionString;
   List list = null;
   condition = conditionBox1.getSelectedItem().toString().trim();
   conditionOperation = conditionBox2.getSelectedItem().toString().trim();
   conditionString = conditionContent.getText().trim();
   if (!conditionString.isEmpty()) {
     String sql = "select * from tb_khinfo where ";
     if (condition.equals("客户全称")) {
       if (conditionOperation.equals("等于"))
         list = Dao.findForList(sql + "khname='" + conditionString + "'");
       else list = Dao.findForList(sql + "khname like '%" + conditionString + "%'");
     } else {
       if (conditionOperation.equals("等于"))
         list = Dao.findForList(sql + "jian='" + conditionString + "'");
       else list = Dao.findForList(sql + "jian like '%" + conditionString + "%'");
     }
     updateTable(list, dftm);
   } else showAllButton.doClick();
 }
 private JComboBox getJsrComboBox() {
   if (jsr == null) {
     jsr = new JComboBox();
     List<String> czyList = Dao.getJsr();
     int i = 0;
     for (String str : czyList) {
       String id = String.valueOf(i);
       String name = str;
       Item item = new Item(id, name);
       item.setId(id + "");
       item.setName(name);
       jsr.addItem(item);
       i++;
     }
   }
   return jsr;
 }