Coding yang digunakan dalam pembuatan sistem blockchain tandan buah segar di PTPN IV Kebun Adolina:
1. Coding Form Login Petani Sawit
private void LoginActionPerformed(java.awt.event.ActionEvent evt) {
NamaPetaniSawit.setText("");
Password.setText("");
}
con.close();
}
catch (Exception e){
JOptionPane.showMessageDialog(null,e);
}
// Variables declaration - do not modify private javax.swing.JButton Login;
private javax.swing.JTextField NamaPetaniSawit;
private javax.swing.JTextField Password;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel3;
private javax.swing.JLabel jLabel4;
private javax.swing.JLabel jLabel5;
private javax.swing.JScrollPane jScrollPane1;
private javax.swing.JTextArea jTextArea1;
// End of variables declaration
2. Coding Form Home Petani Sawit
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) { // TODO add your handling code here:
InfoTBS_Pabrik a = new InfoTBS_Pabrik ();
a.setVisible(true);
this.setVisible(false);
}
private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) { // TODO add your handling code here:
Data_Petanisawit a = new Data_Petanisawit ();
a.setVisible(true);
this.setVisible(false);
}
// Variables declaration - do not modify private javax.swing.JButton jButton1;
private javax.swing.JButton jButton2;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel2;
// End of variables declaration }
3. Coding Form Info TBS Pabrik
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) { // TODO add your handling code here:
Home_Petanisawit b = new Home_Petanisawit();
b.setVisible(true);
this.setVisible(false);
}
// Variables declaration - do not modify private javax.swing.JButton jButton1;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel10;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel3;
private javax.swing.JLabel jLabel4;
private javax.swing.JLabel jLabel5;
private javax.swing.JLabel jLabel6;
private javax.swing.JLabel jLabel7;
private javax.swing.JLabel jLabel8;
private javax.swing.JLabel jLabel9;
private javax.swing.JScrollPane jScrollPane1;
private javax.swing.JTextArea jTextArea1;
4. Coding Form Data Petani Sawit
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) { // TODO add your handling code here:
try{
String query = "INSERT INTO `data_petanisawit`(`Nama`,
`JenisKelamin`, `Lokasi`, `NoTelepon`, `BeratSawit`, `NamaPengumpul`,
`HargaTBSpengumpul`, `Tanggal`) VALUES (?,?,?,?,?,?,?,?)";
Connection con =
JOptionPane.showMessageDialog(null,"Berhasil Disimpan");
}
catch (Exception ex){
JOptionPane.showMessageDialog(null, ex);
} }
private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) { // TODO add your handling code here:
Login_Petanisawit b = new Login_Petanisawit();
b.setVisible(true);
this.setVisible(false);
}
// Variables declaration - do not modify private javax.swing.JTextField Beratsawit;
private javax.swing.JTextField HargaTBSpengumpul;
private javax.swing.JComboBox<String> Jeniskelamin;
private javax.swing.JTextField Lokasi;
private javax.swing.JTextField Nama;
private javax.swing.JTextField Namapengumpul;
private javax.swing.JTextField Notelepon;
private com.toedter.calendar.JDateChooser Tanggal;
private javax.swing.JButton jButton1;
private javax.swing.JButton jButton2;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel10;
private javax.swing.JLabel jLabel11;
private javax.swing.JLabel jLabel12;
private javax.swing.JLabel jLabel14;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel3;
private javax.swing.JLabel jLabel4;
private javax.swing.JLabel jLabel5;
private javax.swing.JLabel jLabel6;
private javax.swing.JLabel jLabel7;
private javax.swing.JLabel jLabel8;
private javax.swing.JLabel jLabel9;
private javax.swing.JScrollPane jScrollPane1;
private javax.swing.JTextArea jTextArea1;
// End of variables declaration }
5. Coding Form Login Supplier
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) { // TODO add your handling code here:
try {
Class.forName("com.mysql.jdbc.Driver");
Connection con =
DriverManager.getConnection("jdbc:mysql://localhost:3306/database_user","root","");
String sql = "Select * from loginuser where username=? and password=?";
PreparedStatement pst = con.prepareCall(sql);
pst.setString(1,username.getText());
pst.setString(2,password.getText());
ResultSet rs =pst.executeQuery();
if(rs.next()){
JOptionPane.showMessageDialog(null,"Login Berhasil");
Home_Supplier a = new Home_Supplier();
a.setVisible(true);
this.setVisible(false);
} else{
JOptionPane.showMessageDialog(null,"Login Gagal");
username.setText("");
password.setText("");
}
con.close();
}
catch (Exception e){
JOptionPane.showMessageDialog(null,e);
}
}
// Variables declaration - do not modify private javax.swing.JButton jButton1;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel3;
private javax.swing.JLabel jLabel4;
private javax.swing.JLabel jLabel5;
private javax.swing.JLabel jLabel6;
private javax.swing.JPanel jPanel1;
private javax.swing.JPasswordField jPasswordField1;
private javax.swing.JPasswordField password;
private javax.swing.JTextField username;
// End of variables declaration }
6. Coding Form Home Supplier
private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) { // TODO add your handling code here:
Data_TBS a = new Data_TBS();
a.setVisible(true);
this.setVisible(false);
}
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) { // TODO add your handling code here:
Data_Supplier a = new Data_Supplier();
a.setVisible(true);
this.setVisible(false);
}
// Variables declaration - do not modify private javax.swing.JButton jButton1;
private javax.swing.JButton jButton2;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel2;
private javax.swing.JScrollPane jScrollPane1;
private javax.swing.JTextArea jTextArea1;
// End of variables declaration
7. Coding Form Data Supplier
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) { try{
String query = "INSERT INTO `datasupplier`(`NamaDepan`, `NamaBelakang`,
`Alamat`, `JenisKelamin`, `Email`, `NoTelepon`, `NoRekening`, `Bank`,
`NamaRekening`) VALUES (?,?,?,?,?,?,?,?,?)";
con =
DriverManager.getConnection("jdbc:mysql://localhost/namasupplier","root","");
pst = con.prepareStatement(query);
pst.setString(1, NamaDepan.getText());
pst.setString(2, NamaBelakang.getText());
pst.setString(3, Alamat.getText());
pst.setString(4, JenisKelamin.getSelectedItem().toString());
pst.setString(5, Email.getText());
pst.setString(6, NoTelepon.getText());
pst.setString(7, NoRekening.getText()); private javax.swing.JTextField Alamat;
private javax.swing.JComboBox<String> Bank;
private javax.swing.JTextField Email;
private javax.swing.JComboBox<String> JenisKelamin;
private javax.swing.JTextField NamaBelakang;
private javax.swing.JTextField NamaDepan;
private javax.swing.JTextField NamaRekening;
private javax.swing.JTextField NoRekening;
private javax.swing.JTextField NoTelepon;
private javax.swing.JButton jButton1;
private javax.swing.JButton jButton3;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel11;
private javax.swing.JLabel jLabel18;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel3;
private javax.swing.JLabel jLabel4;
private javax.swing.JLabel jLabel5;
private javax.swing.JLabel jLabel6;
private javax.swing.JLabel jLabel7;
private javax.swing.JLabel jLabel8;
private javax.swing.JLabel jLabel9;
private javax.swing.JScrollPane jScrollPane1;
private javax.swing.JTextArea jTextArea1;
// End of variables declaration }
8. Coding Form Data TBS
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) { // TODO add your handling code here:
try{
String query = "INSERT INTO `datatbs`(`JumlahTBS`, `Lokasi`,
`HargaTBSsupplier`, `Tanggal`) VALUES (?,?,?,?)";
Connection con = DriverManager.getConnection("jdbc:mysql://localhost/data_tbs","root","");
PreparedStatement pst = con.prepareStatement(query);
pst.setString(1, JumlahTBS.getText());
pst.setString(2, Lokasi.getText());
pst.setString(3, HargaTBSsupplier.getText());
pst.setString(4,((JTextField)Tanggal.getDateEditor().getUiComponent()).getText(
));
pst.executeUpdate();
JOptionPane.showMessageDialog(null,"Berhasil Disimpan");
}
catch (Exception ex){
JOptionPane.showMessageDialog(null, ex);
}
private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) { // TODO add your handling code here:
Login_Supplier a = new Login_Supplier();
a.setVisible(true);
this.setVisible(false);
}
// Variables declaration - do not modify private javax.swing.JTextField HargaTBSsupplier;
private javax.swing.JTextField JumlahTBS;
private javax.swing.JTextField Lokasi;
private com.toedter.calendar.JDateChooser Tanggal;
private javax.swing.JButton jButton1;
private javax.swing.JButton jButton2;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel10;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel3;
private javax.swing.JLabel jLabel4;
private javax.swing.JLabel jLabel5;
private javax.swing.JLabel jLabel6;
private javax.swing.JLabel jLabel7;
private javax.swing.JLabel jLabel8;
private javax.swing.JScrollPane jScrollPane1;
private javax.swing.JTextArea jTextArea1;
// End of variables declaration }
9. Coding Form Login Admin Pabrik // TODO add your handling code here:
PreparedStatement pst = con.prepareStatement (sql);
// Variables declaration - do not modify private javax.swing.JTextField Nama_Admin;
private javax.swing.JPasswordField Password;
private javax.swing.JButton jButton1;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel3;
private javax.swing.JLabel jLabel4;
private javax.swing.JLabel jLabel6;
private javax.swing.JScrollPane jScrollPane2;
private javax.swing.JTextArea jTextArea2;
// End of variables declaration }
10. Coding Form Home Admin Pabrik
private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) { // TODO add your handling code here:
Data_PembelianTBS b = new Data_PembelianTBS();
b.setVisible(true);
this.setVisible(false);
}
private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) { // TODO add your handling code here: