private void addData() {
   DBType dbType =
       (DBType)
           JOptionPane.showInputDialog(
               null,
               "请选择模版:",
               "数据库类型",
               JOptionPane.PLAIN_MESSAGE,
               null,
               DBType.values(),
               DBType.valueOf("MYSQL"));
   if (dbType == null) {
     return;
   }
   DBConnectionInfo dbInfo = ConfigDbUtil.init().getInitDBConnectionInfo(dbType);
   tmDbInfo.addRow(dbInfo);
   jtDbinfo.updateUI();
 }
 private void buildWin() {
   jpbLoading = new JProgressBar(0, 100);
   jfcBrowse = new JFileChooser(Initial.DB_CONFIG_PATH);
   jlConfigPath = new JLabel("配置文件路径:");
   jlStatus = new JLabel("未操作");
   jlConfigPath.setFont(SwingContainerFactory.getFont());
   jlStatus.setFont(SwingContainerFactory.getFont());
   jlStatus.setForeground(Color.RED);
   jpOperatingDbInfo = new JPanel();
   jpStatusBar = new JPanel(new BorderLayout());
   jpDisplay = new JPanel(new BorderLayout());
   jbAddDbInfo = new JButton("添加");
   jbDelDbInfo = new JButton("删除");
   jbSaveDbInfo = new JButton("保存");
   jbBrowse = new JButton("浏览...");
   jbLoadDbInfo = new JButton("加载");
   jbClearDbInfo = new JButton("清空");
   jtfConfigPath = new JTextField(20);
   jbAddDbInfo.setFont(SwingContainerFactory.getFont());
   jbDelDbInfo.setFont(SwingContainerFactory.getFont());
   jbSaveDbInfo.setFont(SwingContainerFactory.getFont());
   jbBrowse.setFont(SwingContainerFactory.getFont());
   jbLoadDbInfo.setFont(SwingContainerFactory.getFont());
   jbClearDbInfo.setFont(SwingContainerFactory.getFont());
   jpOperatingDbInfo.add(jbAddDbInfo);
   jpOperatingDbInfo.add(jbDelDbInfo);
   jpOperatingDbInfo.add(jbClearDbInfo);
   jpOperatingDbInfo.add(jbSaveDbInfo);
   jpOperatingDbInfo.add(jlConfigPath);
   jpOperatingDbInfo.add(jtfConfigPath);
   jpOperatingDbInfo.add(jbBrowse);
   jpOperatingDbInfo.add(jbLoadDbInfo);
   jpStatusBar.add(jpbLoading, BorderLayout.CENTER);
   jpStatusBar.add(jlStatus, BorderLayout.WEST);
   tmDbInfo = new Table();
   jtDbinfo = new JTable(tmDbInfo);
   jtDbinfo.setRowHeight(20);
   jtDbinfo.setBackground(Color.white);
   jtDbinfo.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
   TableColumnModel tcm = jtDbinfo.getColumnModel();
   for (int i = 0; i < tcm.getColumnCount(); i++) {
     tcm.getColumn(i).setPreferredWidth(80);
   }
   tcm.getColumn(10).setPreferredWidth(150);
   tcm.getColumn(11).setPreferredWidth(300);
   tcm.getColumn(3).setCellEditor(new DefaultCellEditor(new JComboBox<DBType>(DBType.values())));
   jspDbInfo = new JScrollPane(jtDbinfo);
   jpDisplay.add(jspDbInfo, BorderLayout.CENTER);
   jpDisplay.add(jpOperatingDbInfo, BorderLayout.NORTH);
   this.add(jpDisplay, BorderLayout.CENTER);
   this.add(jpStatusBar, BorderLayout.SOUTH);
 }
 @Override
 public void setValueAt(Object value, int row, int col) {
   DBConnectionInfo tmp = dbConnectionInfoList.get(row);
   if (tmp == null || value == null) {
     return;
   }
   switch (col) {
     case 0:
       tmp.setDbCode(value.toString());
       break;
     case 1:
       tmp.setDbAddress(value.toString());
       break;
     case 2:
       tmp.setDbPort(value.toString());
       break;
     case 3:
       tmp.setDbType(DBType.valueOf(value.toString()));
       break;
     case 4:
       tmp.setDbName(value.toString());
       break;
     case 5:
       tmp.setDbUsername(value.toString());
       break;
     case 6:
       tmp.setDbPassword(value.toString());
       break;
     case 7:
       tmp.setDbTestSQL(value.toString());
       break;
     case 8:
       tmp.setMaxConnectionNum(Integer.valueOf(value.toString()));
       break;
     case 9:
       tmp.setMinConnectionNum(Integer.valueOf(value.toString()));
       break;
   }
   DBType dbtype = tmp.getDbType() == null ? DBType.MYSQL : tmp.getDbType();
   tmp.initConnectionString(ConfigDbUtil.init().getConnectionStringFormat(dbtype));
   for (int i = 0; i < title.length; i++) {
     this.fireTableCellUpdated(row, i);
   }
 }