Ukom Manual

You might also like

Download as txt, pdf, or txt
Download as txt, pdf, or txt
You are on page 1of 6

Langkah Manual :

> instal Xampp, NetBeans


> sebelum memulai di xampp, kita harus menyalakan bagian apache dan mysql dengan
klik tombol start
> setelah itu, sebelum masuk membuat coding di netbeans. buat terlebih dahulu form
nya (desain)

Langkah Manual :
> Program dijalankan
> Lalu akan masuk ke tampilan form regestrasi akun mahasiswa
> User di minta untuk memasukkan data sesuai yang di minta, (Username, Password,
Nama dan NIM)
> Setelah itu klik icon/tombol registrasi
> Jika data berhasil di simpan akan keluar notifikasi atau tampilan bahwa
registrasi berhasil
> Setelah berhasil registrasi, maka data akan tersimpan di database (database dapat
di edit dan hapus) yang di simpan dan dapat dilihat di phpMyAdmin

CODING :

/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
import java.awt.HeadlessException;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.sql.Statement;
import javax.swing.JOptionPane;

/**
*
*
*/

public class Fomregistrasi extends javax.swing.JFrame {


Connection con = null;
Statement st = null;

/**
* Creates new form Fomregistrasi
*/
public Fomregistrasi() {
initComponents();
}
private void hapuslayar(){
txtuser.setText("");
txtpass.setText("");
txtpassword.setText("");
txtnama.setText("");
txtnim.setText("");

}
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">

private void initComponents() {

jLabel1 = new javax.swing.JLabel();


txtuser = new javax.swing.JTextField();
jLabel2 = new javax.swing.JLabel();
jLabel3 = new javax.swing.JLabel();
txtpassword = new javax.swing.JTextField();
jLabel4 = new javax.swing.JLabel();
txtnama = new javax.swing.JTextField();
txtpass = new javax.swing.JPasswordField();
jLabel5 = new javax.swing.JLabel();
txtnim = new javax.swing.JTextField();
jButton1 = new javax.swing.JButton();
jLabel6 = new javax.swing.JLabel();

setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

jLabel1.setText("User Name :");

txtuser.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N

jLabel2.setText("Password :");

jLabel3.setText("Ulang Password :");

txtpassword.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N


txtpassword.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
txtpasswordActionPerformed(evt);
}
});

jLabel4.setText("Nama :");

txtnama.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N

txtpass.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N

jLabel5.setText("Nim :");

txtnim.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N

jButton1.setFont(new java.awt.Font("Trebuchet MS", 1, 14)); // NOI18N


jButton1.setText("Registrasi");
jButton1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton1ActionPerformed(evt);
}
});

jLabel6.setFont(new java.awt.Font("Tw Cen MT Condensed Extra Bold", 0,


36)); // NOI18N
jLabel6.setText("FORM REGISTRASI AKUN MAHASISWA");

javax.swing.GroupLayout layout = new


javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignm
ent.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING,
layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayou
t.Alignment.LEADING)
.addGroup(layout.createParallelGroup(javax.swing.GroupL
ayout.Alignment.TRAILING, false)
.addComponent(jLabel4,
javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE,
Short.MAX_VALUE)
.addComponent(jLabel3,
javax.swing.GroupLayout.DEFAULT_SIZE, 107, Short.MAX_VALUE)
.addComponent(jLabel5,
javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE,
Short.MAX_VALUE))
.addComponent(jLabel2)
.addComponent(jLabel1,
javax.swing.GroupLayout.PREFERRED_SIZE, 107,
javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(4, 4, 4)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayou
t.Alignment.LEADING)
.addComponent(txtpass,
javax.swing.GroupLayout.PREFERRED_SIZE, 113,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(txtuser,
javax.swing.GroupLayout.PREFERRED_SIZE, 220,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(txtpassword,
javax.swing.GroupLayout.PREFERRED_SIZE, 113,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(txtnama,
javax.swing.GroupLayout.PREFERRED_SIZE, 220,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(txtnim,
javax.swing.GroupLayout.PREFERRED_SIZE, 113,
javax.swing.GroupLayout.PREFERRED_SIZE))
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE,
Short.MAX_VALUE))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING,
layout.createSequentialGroup()
.addGap(0, 98, Short.MAX_VALUE)
.addComponent(jLabel6,
javax.swing.GroupLayout.PREFERRED_SIZE, 528,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(69, 69, 69))))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING,
layout.createSequentialGroup()
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE,
Short.MAX_VALUE)
.addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE,
107, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(94, 94, 94))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(14, 14, 14)
.addComponent(jLabel6, javax.swing.GroupLayout.PREFERRED_SIZE, 39,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignm
ent.BASELINE)
.addComponent(jLabel1, javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(txtuser, javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELAT
ED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignm
ent.BASELINE)
.addComponent(jLabel2)
.addComponent(txtpass, javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(12, 12, 12)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignm
ent.BASELINE)
.addComponent(jLabel3, javax.swing.GroupLayout.PREFERRED_SIZE,
25, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(txtpassword,
javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(12, 12, 12)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignm
ent.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(7, 7, 7)
.addComponent(jLabel4))
.addComponent(txtnama,
javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(18, 18, 18)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignm
ent.BASELINE)
.addComponent(jLabel5)
.addComponent(txtnim, javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(18, 18, 18)
.addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 41,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(46, 46, 46))
);

pack();
}// </editor-fold>

private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {


// TODO add your handling code here:
try{
if (txtuser.getText().equals("")||txtpass.getPassword().equals("")||
txtnama.getText().equals("")){
JOptionPane.showMessageDialog(this,"Data Tidak Boleh
Kosong","Pesan",JOptionPane.ERROR_MESSAGE);
hapuslayar();
}else{
Class.forName("com.mysql.jdbc.Driver");
con =
DriverManager.getConnection("jdbc:mysql://localhost/dblogin","root","");
st = con.createStatement();
String simpan = "insert into registrasi values('
"+txtuser.getText()+"','"
+ String.valueOf(txtpass.getPassword())+
"','"+txtnama.getText()+"','"+txtnim.getText()+"')";
st=con.createStatement();
int SA = st.executeUpdate(simpan);
JOptionPane.showMessageDialog(this,"Registrasi berhasil");
this.setVisible(false);
new fomlogin().setVisible(true);
}
}catch(HeadlessException | ClassNotFoundException | SQLException e){
JOptionPane.showMessageDialog(this,"Akun sudah ada",
"pesan",JOptionPane.WARNING_MESSAGE) ;
hapuslayar();
}
}

private void txtpasswordActionPerformed(java.awt.event.ActionEvent evt) {

// TODO add your handling code here:


}

/**
* @param args the command line arguments
*/
public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code
(optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the
default look and feel.
* For details see
http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
*/
try {
for (javax.swing.UIManager.LookAndFeelInfo info :
javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException | InstantiationException |
IllegalAccessException | javax.swing.UnsupportedLookAndFeelException ex) {

java.util.logging.Logger.getLogger(Fomregistrasi.class.getName()).log(java.util.log
ging.Level.SEVERE, null, ex);
}
//</editor-fold>

//</editor-fold>

/* Create and display the form */


java.awt.EventQueue.invokeLater(() -> {
new Fomregistrasi().setVisible(true);
});
}

// 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.JTextField txtnama;
private javax.swing.JTextField txtnim;
private javax.swing.JPasswordField txtpass;
private javax.swing.JTextField txtpassword;
private javax.swing.JTextField txtuser;
// End of variables declaration
}

You might also like