Professional Documents
Culture Documents
Projek PBO 20170803115 Hega Agus Utama
Projek PBO 20170803115 Hega Agus Utama
Projek PBO 20170803115 Hega Agus Utama
Nim : 20170803115
1. Pseukode LOG_IN
/*
* 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.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.Statement;
import javax.swing.JOptionPane;
/**
*
* @author Dekstop
*/
public class LOG_IN extends javax.swing.JFrame {
Connection con;
Statement stat;
ResultSet rs;
String sql;
/**
* Creates new form LOG_IN
*/
public LOG_IN() {
initComponents();
koneksi DB = new koneksi();
DB.config();
con = DB.con;
stat = DB.stm;
/**
* 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() {
jCheckBoxMenuItem1.setSelected(true);
jCheckBoxMenuItem1.setText("jCheckBoxMenuItem1");
jMenu3.setText("jMenu3");
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
JpassPass.setText("hegaagusutama");
JpassPass.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
JpassPassActionPerformed(evt);
}
});
JlbUser.setText("UserName");
JlbPass.setText("Password");
JbtRegis.setText("REGISTER");
JbtRegis.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
JbtRegisActionPerformed(evt);
}
});
JbtLogIn.setText("LOG IN");
JbtLogIn.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
JbtLogInActionPerformed(evt);
}
});
jMenu1.setText("File");
jMenuBar1.add(jMenu1);
jMenu2.setText("Edit");
jMenuBar1.add(jMenu2);
setJMenuBar(jMenuBar1);
pack();
}// </editor-fold>
try {
sql = "SELECT * FROM admin WHERE username='"+JtxtUser.getText()+"' AND
password='"+JpassPass.getText()+"'";
rs = stat.executeQuery(sql);
if(rs.next()){
if(JtxtUser.getText().equals(rs.getString("username")) &&
JpassPass.getText().equals(rs.getString("password"))){
JOptionPane.showMessageDialog(null, "berhasil login");
}
}else{
JOptionPane.showMessageDialog(null, "username atau password salah");
}
} catch (Exception e) {
JOptionPane.showMessageDialog(this, e.getMessage());
}
/**
* @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 ex) {
java.util.logging.Logger.getLogger(LOG_IN.class.getName()).log(java.util.logging.Level.SE
VERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(LOG_IN.class.getName()).log(java.util.logging.Level.SE
VERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(LOG_IN.class.getName()).log(java.util.logging.Level.SE
VERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(LOG_IN.class.getName()).log(java.util.logging.Level.SE
VERE, null, ex);
}
//</editor-fold>
2. Pseukode PESAN
/*
* 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 javax.swing.JOptionPane;
/**
*
* @author Dekstop
*/
public class PESAN extends javax.swing.JFrame {
int Harga, jumlah, total;
/**
* Creates new form PESAN
*/
public PESAN() {
initComponents();
}
/**
* 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() {
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
jLabel3.setText("Nama");
jLabel5.setText("Tanggal Lahir");
jLabel6.setText("Jenis Tiket");
jLabel7.setText("Harga Tiket");
jLabel8.setText("Jumlah Tiket");
RBVVIP.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
RBVVIPActionPerformed(evt);
}
});
RBVIPA.setText("VIP A");
RBVIPA.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
RBVIPAActionPerformed(evt);
}
});
RBVIPB.setText("VIP B");
RBVIPB.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
RBVIPBActionPerformed(evt);
}
});
RBPINKA.setText("PINK A");
RBPINKA.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
RBPINKAActionPerformed(evt);
}
});
RBPINKB.setText("PINK B");
RBPINKB.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
RBPINKBActionPerformed(evt);
}
});
RBBLUE.setText("BLUE");
RBBLUE.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
RBBLUEActionPerformed(evt);
}
});
RBYELLOWA.setText("YELLOW A");
RBYELLOWA.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
RBYELLOWAActionPerformed(evt);
}
});
RBYELLOWB.setText("YELLOW B");
RBYELLOWB.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
RBYELLOWBActionPerformed(evt);
}
});
JBTotal.setText("TOTAL");
JBTotal.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
JBTotalActionPerformed(evt);
}
});
JBKeluar.setText("KELUAR");
JBKeluar.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
JBKeluarActionPerformed(evt);
}
});
JBTampil.setText("TAMPIL");
JBTampil.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
JBTampilActionPerformed(evt);
}
});
JbKembali.setText("BACK");
JbKembali.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
JbKembaliActionPerformed(evt);
}
});
pack();
}// </editor-fold>
private void ComboBoxTahunActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
}
pesan = pesan +"Jenis Tiket : "+JenisTiket+"\n";
pesan = pesan +"Harga Tiket :"+TxtHarga.getText()+"\n";
pesan = pesan +"Jumlah Tiket :"+TxtJumlah.getText()+"\n";
pesan = pesan +"Total Harga Tiket :"+TxtTotal.getText()+"\n";
JOptionPane.showMessageDialog(null,pesan, "TAMPIL DATA",
JOptionPane.INFORMATION_MESSAGE);
}
/**
* @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 ex) {
java.util.logging.Logger.getLogger(PESAN.class.getName()).log(java.util.logging.Level.SE
VERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(PESAN.class.getName()).log(java.util.logging.Level.SE
VERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(PESAN.class.getName()).log(java.util.logging.Level.SE
VERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(PESAN.class.getName()).log(java.util.logging.Level.SE
VERE, null, ex);
}
//</editor-fold>
/*
* 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.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.Statement;
import javax.swing.JOptionPane;
/**
*
* @author Dekstop
*/
public class koneksi {
Connection con;
Statement stm;
try {
Class.forName("com.mysql.jdbc.Driver");
con = DriverManager.getConnection("jdbc:mysql://localhost/login", "root", "");
stm = con.createStatement();
} catch (Exception e)
{
JOptionPane.showMessageDialog(null, "koneksi gagal "+e.getMessage());
}
}
4. Pseukode REGISTER
/*
* 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 javax.swing.JOptionPane;
/**
*
* @author Dekstop
*/
public class REGISTER extends javax.swing.JFrame {
String input;
/**
* Creates new form REGISTER
*/
public REGISTER() {
initComponents();
}
/**
* 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() {
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
JbUser.setText("User Name");
Jbpass.setText("Password");
Jbpass1.setText("Password");
JbREGISTER.setText("REGISTER");
JbREGISTER.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
JbREGISTERActionPerformed(evt);
}
});
JpassPass.setText("jPasswordField1");
JpassPass.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
JpassPassActionPerformed(evt);
}
});
JpasPass1.setText("jPasswordField2");
JpasPass1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
JpasPass1ActionPerformed(evt);
}
});
pack();
}// </editor-fold>
/**
* @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 ex) {
java.util.logging.Logger.getLogger(REGISTER.class.getName()).log(java.util.logging.Level.
SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(REGISTER.class.getName()).log(java.util.logging.Level.
SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(REGISTER.class.getName()).log(java.util.logging.Level.
SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(REGISTER.class.getName()).log(java.util.logging.Level.
SEVERE, null, ex);
}
//</editor-fold>