how to get value from jTable?
i use mouse click event for my jtable and then, i want to set value to datechooser
usually my behaviour for get value from jTable to Textfield, i'm using this method
and then value from jTable success fill to textfield.txtNamaKlien.setText(String.valueOf(jTable1.getValueAt(jTable1.getSelectedRow(), 1)));
my problem value from jTable not success fill to jdatechooser, i'm using this method
Date tanggal = (Date) jTable1.getValueAt(jTable1.getSelectedRow(), 2); jDateChooser1.setDate(tanggal);
and i'm get an error
java.lang.ClassCastException: java.lang.String cannot be cast to java.util.Date
How to fix that?
i'm using database mySQL
when inserting data, i use this method
java.text.SimpleDateFormat fmt = new java.text.SimpleDateFormat("yyyy-MM-dd"); String formattedDate1 = fmt.format(jDateChooser1.getDate());
please help me, and sorry for my bad english