Advertisement
fahmihilmansyah

Untitled

Jun 26th, 2013
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.88 KB | None | 0 0
  1.  
  2. paste code ini
  3.  
  4. int baris = tableInputGuru.getSelectedRow();
  5.         String nip = (String) tableInputGuru.getValueAt(baris, 1);
  6.         String namaGuru = (String) tableInputGuru.getValueAt(baris, 2);
  7.         String tempatLahir = (String) tableInputGuru.getValueAt(baris, 3);
  8.         String tanggalLahir = (String) tableInputGuru.getValueAt(baris, 4);
  9.         String alamat = (String) tableInputGuru.getValueAt(baris, 5);
  10.         String mengajar = (String) tableInputGuru.getValueAt(baris, 6);
  11.         String pendidikan = (String) tableInputGuru.getValueAt(baris, 7);
  12.  
  13.         // --------------------------------------------- //
  14.  
  15.         String query = "select * from tguru where nip ='" + nip + "'";
  16.         try {
  17.             //inisialisasi date untuk ke JDateChooser
  18.             java.util.Date date = new SimpleDateFormat("dd-MM-yyyy").parse(tanggalLahir);
  19.             Koneksi koneksi = new Koneksi();
  20.             Statement statement = koneksi.getConnection().createStatement();
  21.             ResultSet rs = statement.executeQuery(query);
  22.             while (rs.next()) {
  23.                 nip = rs.getString("nip");
  24.             }
  25.             textNip.setText(nip);
  26.             textNamaGuru.setText(namaGuru);
  27.             textTempatLahir.setText(tempatLahir);
  28.             //((JTextField) textTanggalLahir.getDateEditor().getUiComponent()).setText(tanggalLahir);
  29.             //menampilkan hasil parsing date ke jdatechooser
  30.             textTanggalLahir.setDate(date);
  31.             textAlamat.setText(alamat);
  32.             textMengajar.setText(mengajar);
  33.             textPendidikan.setText(pendidikan);
  34.             textNip.setEnabled(false);
  35.             buttonUpdate.setEnabled(true);
  36.             buttonDelete.setEnabled(true);
  37.             buttonInsert.setEnabled(false);
  38.         } catch (Exception e) {
  39.             System.out.println("Terjadi Kesalahan Karena " + e.getMessage());
  40.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement