Hi.I created a jtable and imported a table from mysql there.now i created 3 jtextfield and 1 jdatechooser.Now i want to see the value of any row in the jtextfield and and jdatechooser when a row is clicked.I created the following method for this.It worked for the textfield but didn't worked for date.What the change should i make?In addition in case of "time" what will i do?
private void table_doctorMouseClicked(java.awt.event.MouseEvent evt) {
int row= table_doctor.getSelectedRow();
String Table_click=(table_doctor.getModel().getValueAt( row, 0).toString());
try{
String sql="select * from doctor_info where sl_no='"+Table_click+"'";
pst=conn.prepareStatement(sql);
rs=pst.executeQuery();
md = rs.getMetaData();
if(rs.next()){
String add1=rs.getString("name");
jTextField1.setText(add1);
String add2=rs.getString("cell_no");
jTextField2.setText(add2);
String add3=rs.getString("email");
jTextField3.setText(add3);
String value4= rs.getString("joining_date");
jDateChooser1.setDateFormatString(value4);
}
}
catch(Exception e){
JOptionPane.showMessageDialog(null, e);
}
}