List of usage examples for javax.swing.table DefaultTableCellRenderer DefaultTableCellRenderer
public DefaultTableCellRenderer()
From source file:logdruid.ui.table.EventRecordingEditorTable.java
public void setUpTypeColumn(JTable theTable, TableColumn typeColumn) { // Set up the editor for the type cells. JComboBox comboBox = new JComboBox(); comboBox.addItem("word"); comboBox.addItem("string"); comboBox.addItem("long"); comboBox.addItem("double"); comboBox.addItem("date"); comboBox.addItem("percent"); typeColumn.setCellEditor(new DefaultCellEditor(comboBox)); // Set up tool tips for the type cells. DefaultTableCellRenderer renderer = new DefaultTableCellRenderer(); renderer.setToolTipText("Click for combo box"); typeColumn.setCellRenderer(renderer); }
From source file:org.zaproxy.zap.extension.customFire.ScanProgressDialog.java
/** * Get the main content panel of the dialog * @return the main panel// ww w . j a v a 2 s .c om */ private JTable getMainPanel() { if (table == null) { model = new ScanProgressTableModel(); table = new JTable(); table.setModel(model); table.setRowSelectionAllowed(false); table.setColumnSelectionAllowed(false); table.setDoubleBuffered(true); // First column is for plugin's name table.getColumnModel().getColumn(0).setPreferredWidth(256); table.getColumnModel().getColumn(1).setPreferredWidth(80); // Second column is for plugin's status table.getColumnModel().getColumn(2).setPreferredWidth(80); table.getColumnModel().getColumn(2).setCellRenderer(new ScanProgressBarRenderer()); // Third column is for plugin's elapsed time DefaultTableCellRenderer centerRenderer = new DefaultTableCellRenderer(); centerRenderer.setHorizontalAlignment(JLabel.CENTER); table.getColumnModel().getColumn(3).setPreferredWidth(85); table.getColumnModel().getColumn(3).setCellRenderer(centerRenderer); // Forth column is for plugin's request count DefaultTableCellRenderer rightRenderer = new DefaultTableCellRenderer(); rightRenderer.setHorizontalAlignment(JLabel.RIGHT); table.getColumnModel().getColumn(4).setPreferredWidth(60); table.getColumnModel().getColumn(4).setCellRenderer(rightRenderer); // Fifth column is for plugin's completion and actions table.getColumnModel().getColumn(5).setPreferredWidth(40); table.getColumnModel().getColumn(5).setCellRenderer(new ScanProgressActionRenderer()); ScanProgressActionListener listener = new ScanProgressActionListener(table); table.addMouseListener(listener); table.addMouseMotionListener(listener); } return table; }
From source file:org.pgptool.gui.ui.keyslist.KeysTableView.java
private void adjustColumnsWidths() { DefaultTableCellRenderer leftRenderer = new DefaultTableCellRenderer(); leftRenderer.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 0)); leftRenderer.setHorizontalAlignment(JLabel.LEFT); DefaultTableCellRenderer rightRenderer = new DefaultTableCellRenderer(); rightRenderer.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 0)); rightRenderer.setHorizontalAlignment(JLabel.RIGHT); DefaultTableCellRenderer centerRenderer = new DefaultTableCellRenderer(); centerRenderer.setHorizontalAlignment(JLabel.CENTER); adjustColumn(leftRenderer, KeysTableModel.COLUMN_USER, spacing(30), leftRenderer); adjustColumn(leftRenderer, KeysTableModel.COLUMN_KEY_ID, spacing(16), centerRenderer); adjustColumn(leftRenderer, KeysTableModel.COLUMN_KEY_TYPE, spacing(8), centerRenderer); adjustColumn(leftRenderer, KeysTableModel.COLUMN_ALGORITHM, spacing(13), centerRenderer); adjustColumn(leftRenderer, KeysTableModel.COLUMN_CREATED_ON, spacing(10), centerRenderer); adjustColumn(leftRenderer, KeysTableModel.COLUMN_EXPIRES_AT, spacing(10), centerRenderer); }
From source file:org.zaproxy.zap.extension.ascan.ScanProgressDialog.java
/** * Get the main content panel of the dialog * @return the main panel//from w ww .ja v a 2s. co m */ private JTable getMainPanel() { if (table == null) { model = new ScanProgressTableModel(); table = new JTable(); table.setModel(model); table.setRowSelectionAllowed(false); table.setColumnSelectionAllowed(false); table.setDoubleBuffered(true); // First column is for plugin's name table.getColumnModel().getColumn(0).setPreferredWidth(256); table.getColumnModel().getColumn(1).setPreferredWidth(80); // Second column is for plugin's status table.getColumnModel().getColumn(2).setPreferredWidth(80); table.getColumnModel().getColumn(2).setCellRenderer(new ScanProgressBarRenderer()); // Third column is for plugin's elapsed time DefaultTableCellRenderer centerRenderer = new DefaultTableCellRenderer(); centerRenderer.setHorizontalAlignment(JLabel.CENTER); table.getColumnModel().getColumn(3).setPreferredWidth(85); table.getColumnModel().getColumn(3).setCellRenderer(centerRenderer); // Forth column is for plugin's request count DefaultTableCellRenderer rightRenderer = new DefaultTableCellRenderer(); rightRenderer.setHorizontalAlignment(JLabel.RIGHT); table.getColumnModel().getColumn(4).setPreferredWidth(60); table.getColumnModel().getColumn(4).setCellRenderer(rightRenderer); // Fifth column is for plugin's completion and actions table.getColumnModel().getColumn(5).setPreferredWidth(40); table.getColumnModel().getColumn(5).setCellRenderer(new ScanProgressActionRenderer()); ScanProgressActionListener listener = new ScanProgressActionListener(table); table.addMouseListener(listener); table.addMouseMotionListener(listener); } return table; }
From source file:ecosim.gui.SummaryPane.java
/** * Private method to build the table pane. * * @return A JLayeredPane containing the table pane. *//*from ww w.j av a2 s.c om*/ private JLayeredPane makeTablePane() { String[] columnNames = { "", "Estimate", "Hillclimbing", "Low", "High" }; Integer[] columnWidths = { 250, 60, 60, 60, 60 }; Object[][] rowData = { { "Number of putative ecotypes (npop)", null, null, null, null }, { "Rate of ecotype formation (omega)", null, null, null, null }, { "Rate of periodic selection (sigma)", null, null, null, null } }; final JLayeredPane pane = new JLayeredPane(); final JTable table = new JTable(rowData, columnNames) { public boolean isCellEditable(int row, int column) { return false; } }; final JTableHeader header = table.getTableHeader(); pane.setLayout(new BorderLayout()); header.setReorderingAllowed(false); TableColumnModel cm = table.getColumnModel(); for (int i = 0; i < columnWidths.length; i++) { TableColumn column = cm.getColumn(i); column.setMinWidth(columnWidths[i]); if (i == 0) { column.setCellRenderer(new DefaultTableCellRenderer() { public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { Component cell = super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column); cell.setBackground(header.getBackground()); cell.setForeground(header.getForeground()); return cell; } }); } } pane.add(table.getTableHeader(), "North"); pane.add(table, "Center"); // Watch for changes to the Summary object. summary.addObserver(new Observer() { public void update(Observable o, Object obj) { Summary s = (Summary) obj; ParameterEstimate estimate = s.getEstimate(); ParameterSet hillclimbing = s.getHillclimbing(); ParameterSet[] ci = s.getConfidenceInterval(); if (estimate != null) { ParameterSet e = estimate.getResult(); table.setValueAt(e.getNpop(), 0, 1); table.setValueAt(String.format("%.4f", e.getOmega()), 1, 1); table.setValueAt(String.format("%.4f", e.getSigma()), 2, 1); } if (hillclimbing != null) { table.setValueAt(hillclimbing.getNpop(), 0, 2); table.setValueAt(String.format("%.4f", hillclimbing.getOmega()), 1, 2); table.setValueAt(String.format("%.4f", hillclimbing.getSigma()), 2, 2); } if (ci[0].getNpop() != null) { table.setValueAt(ci[0].getNpop(), 0, 3); table.setValueAt(ci[1].getNpop(), 0, 4); } if (ci[1].getOmega() != null) { table.setValueAt(String.format("%.4f", ci[0].getOmega()), 1, 3); String fmt = "%.4f"; if (ci[1].getOmega() > 10.0D) { fmt = "%.1f"; } else if (ci[1].getOmega() > 1.0D) { fmt = "%.2f"; } table.setValueAt(String.format(fmt, ci[1].getOmega()), 1, 4); } if (ci[1].getSigma() != null) { table.setValueAt(String.format("%.4f", ci[0].getSigma()), 2, 3); if (ci[1].getSigma() > 100.0D - MasterVariables.EPSILON) { table.setValueAt("100", 2, 4); } else { String fmt = "%.4f"; if (ci[1].getSigma() > 10.0D) { fmt = "%.1f"; } else if (ci[1].getSigma() > 1.0D) { fmt = "%.2f"; } table.setValueAt(String.format(fmt, ci[1].getSigma()), 2, 4); } } pane.repaint(); } }); return pane; }
From source file:de.mprengemann.intellij.plugin.androidicons.forms.AndroidBatchScaleImporter.java
private void initRenderers() { DefaultTableCellRenderer fileCellRenderer = new DefaultTableCellRenderer() { @Override/*from ww w.j av a 2s .co m*/ protected void setValue(Object o) { File file = (File) o; if (file == null) { setText(""); return; } if (file.isDirectory()) { setText(file.getAbsolutePath()); } else { setText(FilenameUtils.removeExtension(file.getName())); } } }; fileCellRenderer.setHorizontalTextPosition(DefaultTableCellRenderer.RIGHT); table.setDefaultRenderer(File.class, fileCellRenderer); table.setDefaultRenderer(Resolution.class, new DefaultTableCellRenderer() { @Override protected void setValue(Object o) { if (o == null) { setText(""); } else { setText(((Resolution) o).getName()); } } }); table.getColumnModel().getColumn(6).setCellEditor(new TextBrowserEditor()); }
From source file:dbseer.gui.user.DBSeerDataSet.java
public DBSeerDataSet(boolean isLive) { live = new Boolean(isLive); Boolean[] trueFalse = { Boolean.TRUE, Boolean.FALSE }; JComboBox trueFalseBox = new JComboBox(trueFalse); final DefaultCellEditor dce = new DefaultCellEditor(trueFalseBox); uniqueVariableName = "dataset_" + UUID.randomUUID().toString().replace('-', '_'); uniqueModelVariableName = "mv_" + UUID.randomUUID().toString().replace('-', '_'); if (isLive) { name = "Live Data"; }// w w w . jav a 2 s . co m tableModel = new DBSeerDataSetTableModel(null, new String[] { "Name", "Value" }, !isLive); tableModel.addTableModelListener(this); table = new JTable(tableModel) { @Override public TableCellEditor getCellEditor(int row, int col) { if ((row == DBSeerDataSet.TYPE_USE_ENTIRE_DATASET || row > TYPE_NUM_TRANSACTION_TYPE + numTransactionTypes) && col == 1) return dce; return super.getCellEditor(row, col); } }; DefaultTableCellRenderer customRenderder = new DefaultTableCellRenderer() { @Override public Component getTableCellRendererComponent(JTable jTable, Object o, boolean b, boolean b2, int row, int col) { Component cell = super.getTableCellRendererComponent(jTable, o, b, b2, row, col); if (row == DBSeerDataSet.TYPE_START_INDEX || row == DBSeerDataSet.TYPE_END_INDEX) { if (((Boolean) table.getValueAt(DBSeerDataSet.TYPE_USE_ENTIRE_DATASET, 1)) .booleanValue() == true) { cell.setForeground(Color.LIGHT_GRAY); } else { cell.setForeground(Color.BLACK); } } // else if (row == DBSeerDataSet.TYPE_AVERAGE_LATENCY || // row == DBSeerDataSet.TYPE_HEADER || // row == DBSeerDataSet.TYPE_MONITORING_DATA || // row == DBSeerDataSet.TYPE_PERCENTILE_LATENCY || // row == DBSeerDataSet.TYPE_TRANSACTION_COUNT || // row == DBSeerDataSet.TYPE_NUM_TRANSACTION_TYPE || // row == DBSeerDataSet.TYPE_STATEMENT_FILE || // row == DBSeerDataSet.TYPE_QUERY_FILE || // row == DBSeerDataSet.TYPE_TRANSACTION_FILE) else if (row == DBSeerDataSet.TYPE_NUM_TRANSACTION_TYPE) { cell.setForeground(Color.LIGHT_GRAY); } else { cell.setForeground(Color.BLACK); } return cell; } }; table.getColumnModel().getColumn(0).setCellRenderer(customRenderder); table.getColumnModel().getColumn(1).setCellRenderer(customRenderder); table.setFillsViewportHeight(true); table.getColumnModel().getColumn(0).setMaxWidth(400); table.getColumnModel().getColumn(0).setPreferredWidth(300); table.getColumnModel().getColumn(1).setPreferredWidth(600); table.setRowHeight(20); this.useEntireDataSet = true; for (String header : tableHeaders) { if (header.equalsIgnoreCase("Use Entire DataSet")) tableModel.addRow(new Object[] { header, Boolean.TRUE }); else tableModel.addRow(new Object[] { header, "" }); } this.updateLiveDataSet(); for (int i = 0; i < numTransactionTypes; ++i) { tableModel.addRow(new Object[] { "Name of Transaction Type " + (i + 1), "Type " + (i + 1) }); DBSeerTransactionType type = new DBSeerTransactionType("Type " + (i + 1), true); transactionTypes.add(type); } for (int i = 0; i < transactionTypes.size(); ++i) { DBSeerTransactionType txType = transactionTypes.get(i); if (txType.isEnabled()) { tableModel.addRow(new Object[] { "Use Transaction Type " + (i + 1), Boolean.TRUE }); } else { tableModel.addRow(new Object[] { "Use Transaction Type " + (i + 1), Boolean.FALSE }); } } this.updateTable(); dataSetLoaded = false; tableModel.setUseEntireDataSet(this.useEntireDataSet.booleanValue()); }
From source file:edu.ku.brc.af.ui.forms.formatters.DataObjFieldFormatMultiplePanel.java
/** * /*ww w. j a v a 2s. co m*/ */ private void setFormatSwitchTblColumnProperties() { // set details of 1st column (field values) TableColumnModel model = formatSwitchTbl.getColumnModel(); TableColumn column = model.getColumn(model.getColumnIndex(FIELD_VALUE_COL)); column.setMinWidth(20); column.setMaxWidth(300); column.setPreferredWidth(70); DefaultTableCellRenderer renderer = new DefaultTableCellRenderer(); renderer.setHorizontalAlignment(SwingConstants.CENTER); column.setCellRenderer(renderer); // set details of 3rd column (ellipsis buttons) column = model.getColumn(model.getColumnIndex(ELLIPSIS_BUTTON_COL)); column.setCellRenderer(new EditDataObjFormatButtonRenderer()); column.setCellEditor(new EditDataObjFormatButtonEditor(createCheckBox())); column.setMinWidth(20); column.setMaxWidth(20); column.setPreferredWidth(20); }
From source file:cn.labthink.ReadAccess060.java
private void jButton_OpenfileActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton_OpenfileActionPerformed //filter//from www .j a v a 2 s . c om ExtensionFileFilter filter = new ExtensionFileFilter("mdb", false, true); filter.setDescription("Open DataBase File"); //? JFileChooser jfc = new JFileChooser(); FileSystemView fsv = FileSystemView.getFileSystemView(); //? jfc.setCurrentDirectory(fsv.getHomeDirectory()); jfc.setDialogTitle("Choose the mdb file"); jfc.setMultiSelectionEnabled(false); jfc.setDialogType(JFileChooser.OPEN_DIALOG); jfc.setFileSelectionMode(JFileChooser.FILES_ONLY); jfc.setFileFilter(filter); int result = jfc.showOpenDialog(this); // ""? if (result == JFileChooser.APPROVE_OPTION) { String filesrc = jfc.getSelectedFile().getAbsolutePath(); inputfile = jfc.getSelectedFile(); jLabel_dbpath.setText("DB File Path:" + filesrc); maxid = Integer.MIN_VALUE; minid = Integer.MAX_VALUE; } else { return; } // Infodata = new Vector(); Infocolumns = new Vector(); try { // String url = "jdbc:odbc:driver={Microsoft Access Driver (*.mdb, *.accdb)};DBQ=D://b.MDB"; if (inputfile == null) { return; } initDB(); sql = conn.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_READ_ONLY); rs = sql.executeQuery("SELECT * FROM test order by testid desc"); Infocolumns.add("TestID"); Infocolumns.add("TestType"); Infocolumns.add("DeviceID"); Infocolumns.add("CellID"); Infocolumns.add("Operator"); Infocolumns.add("StartTime"); Infocolumns.add("EndTime"); Infocolumns.add("Comments"); Infocolumns.add("SetTemp."); int columnCount = Infocolumns.size(); Vector row; while (rs.next()) { row = new Vector(columnCount); int temp = 0; int ivalue = rs.getInt("TESTID"); maxid = maxid < ivalue ? ivalue : maxid; minid = minid > ivalue ? ivalue : minid; row.add(ivalue); temp = rs.getInt("TESTTYPE"); if (temp == 1) { row.add("OTR"); } else if (temp == 2) { row.add("WVTR"); } else { row.add(temp); } row.add(rs.getInt("DEVICEID")); row.add(rs.getString("CELLID")); row.add(rs.getString("OPERATOR")); row.add(rs.getDate("STARTTIME")); row.add(rs.getDate("ENDTIME")); row.add(rs.getString("COMMENTS")); row.add(rs.getDouble("SETTEMP")); // row.add(rs.getString(11)); // row.add(rs.getInt(10)); Infodata.add(row); } DefaultTableModel tableModel = new DefaultTableModel(Infodata, Infocolumns); jTable1.setModel(tableModel); //? // jTable1.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); jTable1.setSelectionBackground(Color.orange); //? TableRowSorter<TableModel> tableRowSorter = new TableRowSorter<TableModel>(tableModel); jTable1.setRowSorter(tableRowSorter); // jTable1.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); //table DefaultTableCellRenderer tcr = new DefaultTableCellRenderer();// table tcr.setHorizontalAlignment(SwingConstants.CENTER);// ?? jTable1.setDefaultRenderer(Object.class, tcr); // ((DefaultTableCellRenderer) jTable1.getTableHeader().getDefaultRenderer()) .setHorizontalAlignment(SwingConstants.CENTER); // DefaultTableCellRenderer rh = new DefaultTableCellRenderer(); // rh.setHorizontalAlignment(SwingConstants.CENTER); // jTable1.getTableHeader().setDefaultRenderer(rh); jTable1.getColumnModel().getColumn(0).setPreferredWidth(20); jTable1.getColumnModel().getColumn(1).setPreferredWidth(28); jTable1.getColumnModel().getColumn(2).setPreferredWidth(20); jTable1.getColumnModel().getColumn(3).setPreferredWidth(40); jTable1.getColumnModel().getColumn(4).setPreferredWidth(40); jTable1.getColumnModel().getColumn(5).setPreferredWidth(100); jTable1.getColumnModel().getColumn(6).setPreferredWidth(100); jTable1.getColumnModel().getColumn(7).setPreferredWidth(100); } catch (SQLException ee) { System.out.println(ee); } catch (ClassNotFoundException ex) { Logger.getLogger(ReadAccess060.class.getName()).log(Level.SEVERE, null, ex); } finally { try { sql.close(); } catch (Exception e) { } try { rs.close(); } catch (Exception e) { } } // validate(); }
From source file:cn.labthink.ReadAccess330.java
private void jButton_OpenfileActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton_OpenfileActionPerformed //filter/*from w w w. j a v a 2s .c om*/ ExtensionFileFilter filter = new ExtensionFileFilter("mdb", false, true); filter.setDescription("Open DataBase File"); //? JFileChooser jfc = new JFileChooser(); FileSystemView fsv = FileSystemView.getFileSystemView(); //? jfc.setCurrentDirectory(fsv.getHomeDirectory()); jfc.setDialogTitle("Choose the mdb file"); jfc.setMultiSelectionEnabled(false); jfc.setDialogType(JFileChooser.OPEN_DIALOG); jfc.setFileSelectionMode(JFileChooser.FILES_ONLY); jfc.setFileFilter(filter); int result = jfc.showOpenDialog(this); // ""? if (result == JFileChooser.APPROVE_OPTION) { String filesrc = jfc.getSelectedFile().getAbsolutePath(); inputfile = jfc.getSelectedFile(); jLabel_dbpath.setText("DB File Path:" + filesrc); maxid = Integer.MIN_VALUE; minid = Integer.MAX_VALUE; } else { return; } // Infodata = new Vector(); Infocolumns = new Vector(); try { // String url = "jdbc:odbc:driver={Microsoft Access Driver (*.mdb, *.accdb)};DBQ=D://b.MDB"; if (inputfile == null) { return; } initDB(); sql = conn.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_READ_ONLY); rs = sql.executeQuery("SELECT * FROM test order by testid desc"); Infocolumns.add("TestID"); Infocolumns.add("TestType"); Infocolumns.add("DeviceID"); Infocolumns.add("CellID"); Infocolumns.add("Operator"); Infocolumns.add("StartTime"); Infocolumns.add("EndTime"); Infocolumns.add("Comments"); Infocolumns.add("SetTemp."); int columnCount = Infocolumns.size(); Vector row; while (rs.next()) { row = new Vector(columnCount); int temp = 0; int ivalue = rs.getInt("TESTID"); maxid = maxid < ivalue ? ivalue : maxid; minid = minid > ivalue ? ivalue : minid; row.add(ivalue); temp = rs.getInt("TESTTYPE"); if (temp == 1) { row.add("OTR"); } else if (temp == 2) { row.add("WVTR"); } else { row.add(temp); } row.add(rs.getInt("DEVICEID")); row.add(rs.getString("CELLID")); row.add(rs.getString("OPERATOR")); row.add(rs.getDate("STARTTIME")); row.add(rs.getDate("ENDTIME")); row.add(rs.getString("COMMENTS")); row.add(rs.getDouble("SETTEMP")); // row.add(rs.getString(11)); // row.add(rs.getInt(10)); Infodata.add(row); } DefaultTableModel tableModel = new DefaultTableModel(Infodata, Infocolumns); jTable1.setModel(tableModel); //? // jTable1.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); jTable1.setSelectionBackground(Color.orange); //? TableRowSorter<TableModel> tableRowSorter = new TableRowSorter<TableModel>(tableModel); jTable1.setRowSorter(tableRowSorter); // jTable1.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); //table DefaultTableCellRenderer tcr = new DefaultTableCellRenderer();// table tcr.setHorizontalAlignment(SwingConstants.CENTER);// ?? jTable1.setDefaultRenderer(Object.class, tcr); // ((DefaultTableCellRenderer) jTable1.getTableHeader().getDefaultRenderer()) .setHorizontalAlignment(SwingConstants.CENTER); // DefaultTableCellRenderer rh = new DefaultTableCellRenderer(); // rh.setHorizontalAlignment(SwingConstants.CENTER); // jTable1.getTableHeader().setDefaultRenderer(rh); jTable1.getColumnModel().getColumn(0).setPreferredWidth(20); jTable1.getColumnModel().getColumn(1).setPreferredWidth(28); jTable1.getColumnModel().getColumn(2).setPreferredWidth(20); jTable1.getColumnModel().getColumn(3).setPreferredWidth(40); jTable1.getColumnModel().getColumn(4).setPreferredWidth(40); jTable1.getColumnModel().getColumn(5).setPreferredWidth(100); jTable1.getColumnModel().getColumn(6).setPreferredWidth(100); jTable1.getColumnModel().getColumn(7).setPreferredWidth(100); } catch (SQLException ee) { System.out.println(ee); } catch (ClassNotFoundException ex) { Logger.getLogger(ReadAccess330.class.getName()).log(Level.SEVERE, null, ex); } finally { try { sql.close(); } catch (Exception e) { } try { rs.close(); } catch (Exception e) { } } // validate(); }