Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private void jMenuItem1ActionPerformed(java.awt.event.ActionEvent evt) {
- int row=jTable1.getSelectedRow();
- String id= String.valueOf(model.getValueAt(jTable1.getSelectedRow(), 0));
- if(row >= 0){
- jTextField1.setText(jTable1.getValueAt(row, 0).toString());
- jTextField2.setText(jTable1.getValueAt(row, 1).toString());
- jTextField3.setText(jTable1.getValueAt(row, 2).toString());
- jTextField6.setText(jTable1.getValueAt(row, 3).toString());
- Connection conectar=null;
- try{
- Class.forName("com.mysql.jdbc.Driver");
- DriverManager.getConnection("jdbc:mysql://127.0.0.1/proyecto", "root", "");
- } catch (ClassNotFoundException ex) {
- Logger.getLogger(datos.class.getName()).log(Level.SEVERE, null, ex);
- } catch (SQLException ex) {
- Logger.getLogger(datos.class.getName()).log(Level.SEVERE, null, ex);
- }
- try{
- Statement s=conectar.createStatement();
- ResultSet rs=s.executeQuery("SELECT Nombre,Apellido,Email,Telefono,Compañia,Posicion,Foto,Nota,Ruta FROM datos WHERE id='"+id+"'");
- Image i=null;
- Blob blob=rs.getBlob("Foto");
- i=javax.imageio.ImageIO.read(blob.getBinaryStream());
- ImageIcon image = new ImageIcon(i);
- jLabel10.setIcon(image);
- jTextField10.setText(rs.getString(3));
- } catch (SQLException ex) {
- Logger.getLogger(datos.class.getName()).log(Level.SEVERE, null, ex);
- } catch (IOException ex) {
- Logger.getLogger(datos.class.getName()).log(Level.SEVERE, null, ex);
- }
- }else{
- JOptionPane.showMessageDialog(null, "No se selecciono fila");
- }
- }
Add Comment
Please, Sign In to add comment