Projek PBO 20170803115 Hega Agus Utama

You might also like

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

Nama : 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 = new javax.swing.JCheckBoxMenuItem();


jMenu3 = new javax.swing.JMenu();
JpassPass = new javax.swing.JPasswordField();
JtxtUser = new javax.swing.JTextField();
JlbUser = new javax.swing.JLabel();
JlbPass = new javax.swing.JLabel();
JbtRegis = new javax.swing.JButton();
JbtLogIn = new javax.swing.JButton();
JlbLogin = new javax.swing.JLabel();
jMenuBar1 = new javax.swing.JMenuBar();
jMenu1 = new javax.swing.JMenu();
jMenu2 = new javax.swing.JMenu();

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);
}
});

JlbLogin.setFont(new java.awt.Font("Times New Roman", 1, 24)); // NOI18N


JlbLogin.setText("LOG IN");

jMenu1.setText("File");
jMenuBar1.add(jMenu1);

jMenu2.setText("Edit");
jMenuBar1.add(jMenu2);

setJMenuBar(jMenuBar1);

javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());


getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING,
layout.createSequentialGroup()
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE,
Short.MAX_VALUE)
.addComponent(JbtLogIn)
.addGap(34, 34, 34)
.addComponent(JbtRegis)
.addGap(115, 115, 115))
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEAD
ING)
.addGroup(layout.createSequentialGroup()
.addComponent(JlbPass, javax.swing.GroupLayout.PREFERRED_SIZE, 113,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(JpassPass, javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(layout.createSequentialGroup()
.addComponent(JlbUser, javax.swing.GroupLayout.PREFERRED_SIZE, 113,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(JtxtUser)))
.addGap(16, 16, 16))
.addGroup(layout.createSequentialGroup()
.addGap(48, 48, 48)
.addComponent(JlbLogin, javax.swing.GroupLayout.PREFERRED_SIZE, 304,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(48, Short.MAX_VALUE))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addComponent(JlbLogin, javax.swing.GroupLayout.PREFERRED_SIZE, 34,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAI
LING)
.addComponent(JlbUser, javax.swing.GroupLayout.PREFERRED_SIZE, 24,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(JtxtUser, javax.swing.GroupLayout.PREFERRED_SIZE, 27,
javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASE
LINE)
.addComponent(JlbPass, javax.swing.GroupLayout.PREFERRED_SIZE, 20,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(JpassPass, javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 49,
Short.MAX_VALUE)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASE
LINE)
.addComponent(JbtLogIn, javax.swing.GroupLayout.PREFERRED_SIZE, 37,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(JbtRegis, javax.swing.GroupLayout.PREFERRED_SIZE, 37,
javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(84, 84, 84))
);

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

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


// TODO add your handling code here:
PESAN n = new PESAN();
n.setVisible(true);
this.setVisible(false);

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());
}

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


// TODO add your handling code here:
REGISTER n = new REGISTER();
n.setVisible(true);
this.setVisible(false);

private void JpassPassActionPerformed(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 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>

/* Create and display the form */


java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new LOG_IN().setVisible(true);
}
});
}

// Variables declaration - do not modify


private javax.swing.JButton JbtLogIn;
private javax.swing.JButton JbtRegis;
private javax.swing.JLabel JlbLogin;
private javax.swing.JLabel JlbPass;
private javax.swing.JLabel JlbUser;
private javax.swing.JPasswordField JpassPass;
private javax.swing.JTextField JtxtUser;
private javax.swing.JCheckBoxMenuItem jCheckBoxMenuItem1;
private javax.swing.JMenu jMenu1;
private javax.swing.JMenu jMenu2;
private javax.swing.JMenu jMenu3;
private javax.swing.JMenuBar jMenuBar1;
// End of variables declaration
}

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() {

Jp1 = new javax.swing.JPanel();


jLabel1 = new javax.swing.JLabel();
jLabel2 = new javax.swing.JLabel();
jLabel3 = new javax.swing.JLabel();
jLabel4 = new javax.swing.JLabel();
jLabel5 = new javax.swing.JLabel();
jLabel6 = new javax.swing.JLabel();
jLabel7 = new javax.swing.JLabel();
jLabel8 = new javax.swing.JLabel();
jLabel9 = new javax.swing.JLabel();
TxtNama = new javax.swing.JTextField();
TxtNoId = new javax.swing.JTextField();
TxtHarga = new javax.swing.JTextField();
TxtJumlah = new javax.swing.JTextField();
TxtTotal = new javax.swing.JTextField();
ComboBoxTanggal = new javax.swing.JComboBox();
ComboBoxBulan = new javax.swing.JComboBox();
ComboBoxTahun = new javax.swing.JComboBox();
try {
RBVVIP
=(javax.swing.JRadioButton)java.beans.Beans.instantiate(getClass().getClassLoader(),
"tugas2_RBVVIP");
} catch (ClassNotFoundException e) {
e.printStackTrace();
} catch (java.io.IOException e) {
e.printStackTrace();
}
RBVIPA = new javax.swing.JRadioButton();
RBVIPB = new javax.swing.JRadioButton();
RBPINKA = new javax.swing.JRadioButton();
RBPINKB = new javax.swing.JRadioButton();
RBBLUE = new javax.swing.JRadioButton();
RBYELLOWA = new javax.swing.JRadioButton();
RBYELLOWB = new javax.swing.JRadioButton();
JBTotal = new javax.swing.JButton();
JBKeluar = new javax.swing.JButton();
JBTampil = new javax.swing.JButton();
JbKembali = new javax.swing.JButton();

setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

Jp1.setFont(new java.awt.Font("Times New Roman", 1, 12)); // NOI18N

jLabel1.setFont(new java.awt.Font("Times New Roman", 1, 18)); // NOI18N


jLabel1.setText("FORM PEMESANAN TIKET KONSER RHOMA IRAMA");

jLabel2.setFont(new java.awt.Font("Times New Roman", 1, 12)); // NOI18N


jLabel2.setText("KEMBALINYA SANG RAJA DANGDUT");

jLabel3.setText("Nama");

jLabel4.setText("No Identitas / KTP");

jLabel5.setText("Tanggal Lahir");

jLabel6.setText("Jenis Tiket");

jLabel7.setText("Harga Tiket");

jLabel8.setText("Jumlah Tiket");

jLabel9.setText("Total Harga Tiket");

ComboBoxTanggal.setModel(new javax.swing.DefaultComboBoxModel(new String[] {


"0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17",
"18", "19", "20", "21", "22", "23", "24", "25", "26", "27", "28", "29", "30", "31" }));

ComboBoxBulan.setModel(new javax.swing.DefaultComboBoxModel(new String[]


{ "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12" }));

ComboBoxTahun.setModel(new javax.swing.DefaultComboBoxModel(new String[]


{ "1980", "1981", "1982", "1983", "1984", "1985", "1986", "1987", "1988", "1989", "1990",
"1991", "1992", "1993", "1994", "1995", "1996", "1997", "1998", "1999", "2000" }));
ComboBoxTahun.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
ComboBoxTahunActionPerformed(evt);
}
});

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);
}
});

javax.swing.GroupLayout Jp1Layout = new javax.swing.GroupLayout(Jp1);


Jp1.setLayout(Jp1Layout);
Jp1Layout.setHorizontalGroup(
Jp1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(Jp1Layout.createSequentialGroup()
.addGroup(Jp1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.L
EADING)
.addGroup(Jp1Layout.createSequentialGroup()
.addContainerGap()
.addGroup(Jp1Layout.createParallelGroup(javax.swing.GroupLayout.Alignme
nt.LEADING)
.addComponent(jLabel1, javax.swing.GroupLayout.DEFAULT_SIZE, 464,
Short.MAX_VALUE)
.addGroup(Jp1Layout.createSequentialGroup()
.addGroup(Jp1Layout.createParallelGroup(javax.swing.GroupLayout.Ali
gnment.LEADING)
.addGroup(Jp1Layout.createParallelGroup(javax.swing.GroupLayout.
Alignment.LEADING, false)
.addComponent(jLabel7,
javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE,
Short.MAX_VALUE)
.addComponent(jLabel6,
javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE,
Short.MAX_VALUE)
.addComponent(jLabel5,
javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE,
Short.MAX_VALUE)
.addComponent(jLabel3,
javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE,
Short.MAX_VALUE)
.addComponent(jLabel8,
javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE,
Short.MAX_VALUE)
.addComponent(jLabel4,
javax.swing.GroupLayout.PREFERRED_SIZE, 104,
javax.swing.GroupLayout.PREFERRED_SIZE))
.addComponent(jLabel9,
javax.swing.GroupLayout.PREFERRED_SIZE, 85,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(JBTotal))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELA
TED)
.addGroup(Jp1Layout.createParallelGroup(javax.swing.GroupLayout.Ali
gnment.LEADING)
.addGroup(Jp1Layout.createSequentialGroup()
.addGroup(Jp1Layout.createParallelGroup(javax.swing.GroupLayou
t.Alignment.LEADING, false)
.addComponent(TxtJumlah)
.addComponent(TxtHarga)
.addComponent(TxtNoId)
.addComponent(TxtNama)
.addGroup(Jp1Layout.createSequentialGroup()
.addGroup(Jp1Layout.createParallelGroup(javax.swing.GroupL
ayout.Alignment.LEADING, false)
.addComponent(ComboBoxTanggal, 0,
javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(RBVVIP,
javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE,
Short.MAX_VALUE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacem
ent.RELATED)
.addGroup(Jp1Layout.createParallelGroup(javax.swing.GroupL
ayout.Alignment.TRAILING)
.addGroup(javax.swing.GroupLayout.Alignment.LEADING,
Jp1Layout.createSequentialGroup()
.addComponent(ComboBoxBulan,
javax.swing.GroupLayout.PREFERRED_SIZE, 52,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPla
cement.UNRELATED)
.addComponent(ComboBoxTahun,
javax.swing.GroupLayout.PREFERRED_SIZE, 64,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(0, 0, Short.MAX_VALUE))
.addGroup(Jp1Layout.createSequentialGroup()
.addComponent(RBVIPA,
javax.swing.GroupLayout.PREFERRED_SIZE, 51,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPla
cement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(RBVIPB)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPla
cement.UNRELATED)
.addComponent(RBPINKA)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPla
cement.RELATED)
.addComponent(RBPINKB))))
.addGroup(Jp1Layout.createSequentialGroup()
.addComponent(RBBLUE,
javax.swing.GroupLayout.PREFERRED_SIZE, 50,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacem
ent.RELATED)
.addComponent(RBYELLOWA)
.addGap(12, 12, 12)
.addComponent(RBYELLOWB))
.addComponent(TxtTotal))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.R
ELATED, 83, Short.MAX_VALUE))
.addGroup(Jp1Layout.createSequentialGroup()
.addComponent(JBTampil)
.addGap(58, 58, 58)
.addComponent(JBKeluar)
.addGap(52, 52, 52)
.addComponent(JbKembali,
javax.swing.GroupLayout.PREFERRED_SIZE, 73,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(0, 0, Short.MAX_VALUE))))))
.addGroup(Jp1Layout.createSequentialGroup()
.addGap(137, 137, 137)
.addComponent(jLabel2)
.addGap(0, 0, Short.MAX_VALUE)))
.addContainerGap())
);
Jp1Layout.setVerticalGroup(
Jp1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(Jp1Layout.createSequentialGroup()
.addContainerGap()
.addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 29,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 28,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(13, 13, 13)
.addGroup(Jp1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.B
ASELINE)
.addComponent(jLabel3, javax.swing.GroupLayout.PREFERRED_SIZE, 21,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(TxtNama, javax.swing.GroupLayout.PREFERRED_SIZE, 26,
javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(9, 9, 9)
.addGroup(Jp1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.L
EADING)
.addComponent(TxtNoId, javax.swing.GroupLayout.PREFERRED_SIZE, 29,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel4, javax.swing.GroupLayout.PREFERRED_SIZE, 21,
javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(Jp1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.B
ASELINE)
.addComponent(jLabel5, javax.swing.GroupLayout.PREFERRED_SIZE, 26,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(ComboBoxTanggal,
javax.swing.GroupLayout.PREFERRED_SIZE, 26,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(ComboBoxBulan,
javax.swing.GroupLayout.PREFERRED_SIZE, 26,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(ComboBoxTahun,
javax.swing.GroupLayout.PREFERRED_SIZE, 26,
javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(Jp1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.B
ASELINE)
.addComponent(jLabel6, javax.swing.GroupLayout.PREFERRED_SIZE, 21,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(RBVVIP)
.addComponent(RBVIPA)
.addComponent(RBVIPB)
.addComponent(RBPINKA)
.addComponent(RBPINKB))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(Jp1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.B
ASELINE)
.addComponent(RBBLUE)
.addComponent(RBYELLOWA)
.addComponent(RBYELLOWB))
.addGap(20, 20, 20)
.addGroup(Jp1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.B
ASELINE)
.addComponent(jLabel7, javax.swing.GroupLayout.PREFERRED_SIZE, 26,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(TxtHarga, javax.swing.GroupLayout.PREFERRED_SIZE, 26,
javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(Jp1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.B
ASELINE)
.addComponent(jLabel8, javax.swing.GroupLayout.PREFERRED_SIZE, 21,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(TxtJumlah, javax.swing.GroupLayout.PREFERRED_SIZE, 26,
javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(Jp1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.B
ASELINE)
.addComponent(jLabel9, javax.swing.GroupLayout.PREFERRED_SIZE, 22,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(TxtTotal, javax.swing.GroupLayout.PREFERRED_SIZE, 29,
javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(46, 46, 46)
.addGroup(Jp1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.B
ASELINE)
.addComponent(JBTotal, javax.swing.GroupLayout.PREFERRED_SIZE, 33,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(JBKeluar, javax.swing.GroupLayout.PREFERRED_SIZE, 33,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(JBTampil, javax.swing.GroupLayout.PREFERRED_SIZE, 33,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(JbKembali, javax.swing.GroupLayout.PREFERRED_SIZE, 33,
javax.swing.GroupLayout.PREFERRED_SIZE))
.addContainerGap(20, Short.MAX_VALUE))
);

javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());


getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(Jp1, javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.PREFERRED_SIZE)
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(Jp1, javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
);

pack();
}// </editor-fold>
private void ComboBoxTahunActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:

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


// TODO add your handling code here:
TxtHarga.setText("300000");
}

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


// TODO add your handling code here:
TxtHarga.setText("250000");
}

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


// TODO add your handling code here:
TxtHarga.setText("250000");
}

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


// TODO add your handling code here:
TxtHarga.setText("275000");
}

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


// TODO add your handling code here:
TxtHarga.setText("275000");
}

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


// TODO add your handling code here:
TxtHarga.setText("100000");
}

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


// TODO add your handling code here:
TxtHarga.setText("125000");
}

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


// TODO add your handling code here:
TxtHarga.setText("125000");
}
private void JBTotalActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
jumlah = Integer.parseInt(TxtJumlah.getText());
Harga = Integer.parseInt(TxtHarga.getText());
total = jumlah*Harga;
TxtTotal.setText(""+ total);
}

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


// TODO add your handling code here:

int answer = JOptionPane.showConfirmDialog(null, "APAKAH INGIN KELUAR


DARI APPLIKASI INI ??");
if (answer == JOptionPane.OK_OPTION){
dispose();
}
}

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


// TODO add your handling code here:
String pesan ="";
pesan = pesan +"Nama :"+TxtNama.getText()+"\n";
pesan = pesan +"No Identitas / KTP :"+TxtNoId.getText()+"\n";
String JenisTiket="";
if (RBVVIP.isSelected()){
JenisTiket = RBVVIP.getText();
}
else{
JenisTiket = RBVIPA.getText();
JenisTiket = RBVIPB.getText();
JenisTiket = RBPINKA.getText();
JenisTiket = RBPINKB.getText();
JenisTiket = RBBLUE.getText();
JenisTiket = RBYELLOWA.getText();
JenisTiket = RBYELLOWB.getText();

}
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);
}

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


// TODO add your handling code here:
LOG_IN n = new LOG_IN();
n.setVisible(true);
this.setVisible(false);
}

/**
* @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>

/* Create and display the form */


java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new PESAN().setVisible(true);
}
});
}

// Variables declaration - do not modify


private javax.swing.JComboBox ComboBoxBulan;
private javax.swing.JComboBox ComboBoxTahun;
private javax.swing.JComboBox ComboBoxTanggal;
private javax.swing.JButton JBKeluar;
private javax.swing.JButton JBTampil;
private javax.swing.JButton JBTotal;
private javax.swing.JButton JbKembali;
private javax.swing.JPanel Jp1;
private javax.swing.JRadioButton RBBLUE;
private javax.swing.JRadioButton RBPINKA;
private javax.swing.JRadioButton RBPINKB;
private javax.swing.JRadioButton RBVIPA;
private javax.swing.JRadioButton RBVIPB;
private javax.swing.JRadioButton RBVVIP;
private javax.swing.JRadioButton RBYELLOWA;
private javax.swing.JRadioButton RBYELLOWB;
private javax.swing.JTextField TxtHarga;
private javax.swing.JTextField TxtJumlah;
private javax.swing.JTextField TxtNama;
private javax.swing.JTextField TxtNoId;
private javax.swing.JTextField TxtTotal;
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.JLabel jLabel7;
private javax.swing.JLabel jLabel8;
private javax.swing.JLabel jLabel9;
// End of variables declaration
}
3. Pseukode Koneksi

/*
* 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;

public void config(){

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() {

jLabel5 = new javax.swing.JLabel();


jLabel6 = new javax.swing.JLabel();
jPanel1 = new javax.swing.JPanel();
JbEmail = new javax.swing.JLabel();
JbUser = new javax.swing.JLabel();
Jbpass = new javax.swing.JLabel();
Jbpass1 = new javax.swing.JLabel();
JbREGISTER = new javax.swing.JButton();
JpassPass = new javax.swing.JPasswordField();
JpasPass1 = new javax.swing.JPasswordField();
JtxtEmail = new javax.swing.JTextField();
JtxtUser = new javax.swing.JTextField();
JlRegister = new javax.swing.JLabel();

setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

JbEmail.setText("Masukan Alamat Email ");

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);
}
});

JlRegister.setFont(new java.awt.Font("Times New Roman", 1, 18)); // NOI18N


JlRegister.setText("REGITER");
JlRegister.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
jPanel1.setLayout(jPanel1Layout);
jPanel1Layout.setHorizontalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignme
nt.TRAILING)
.addComponent(Jbpass1, javax.swing.GroupLayout.Alignment.LEADING,
javax.swing.GroupLayout.DEFAULT_SIZE, 118, Short.MAX_VALUE)
.addGroup(javax.swing.GroupLayout.Alignment.LEADING,
jPanel1Layout.createSequentialGroup()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alig
nment.TRAILING)
.addGroup(javax.swing.GroupLayout.Alignment.LEADING,
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(JbUser, javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(JbEmail, javax.swing.GroupLayout.DEFAULT_SIZE,
118, Short.MAX_VALUE)
.addComponent(Jbpass, javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addComponent(JlRegister,
javax.swing.GroupLayout.Alignment.LEADING))
.addGap(0, 0, Short.MAX_VALUE)))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignme
nt.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addGap(0, 0, Short.MAX_VALUE)
.addComponent(JbREGISTER))
.addGroup(jPanel1Layout.createSequentialGroup()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alig
nment.LEADING)
.addComponent(JpassPass, javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(JpasPass1, javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(JtxtEmail, javax.swing.GroupLayout.PREFERRED_SIZE,
202, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(JtxtUser, javax.swing.GroupLayout.PREFERRED_SIZE,
202, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(0, 36, Short.MAX_VALUE)))
.addContainerGap())
);
jPanel1Layout.setVerticalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addComponent(JlRegister, javax.swing.GroupLayout.PREFERRED_SIZE, 24,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(12, 12, 12)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignme
nt.BASELINE)
.addComponent(JbEmail, javax.swing.GroupLayout.PREFERRED_SIZE, 30,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(JtxtEmail, javax.swing.GroupLayout.PREFERRED_SIZE, 30,
javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignme
nt.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addGap(34, 34, 34)
.addComponent(JtxtUser, javax.swing.GroupLayout.PREFERRED_SIZE, 30,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(104, 104, 104)
.addComponent(JbREGISTER,
javax.swing.GroupLayout.PREFERRED_SIZE, 32,
javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(jPanel1Layout.createSequentialGroup()
.addGap(46, 46, 46)
.addComponent(JbUser, javax.swing.GroupLayout.PREFERRED_SIZE, 30,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alig
nment.BASELINE)
.addComponent(Jbpass, javax.swing.GroupLayout.PREFERRED_SIZE, 30,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(JpassPass, javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(31, 31, 31)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alig
nment.BASELINE)
.addComponent(Jbpass1, javax.swing.GroupLayout.PREFERRED_SIZE,
30, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(JpasPass1, javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.PREFERRED_SIZE))))
.addContainerGap(34, Short.MAX_VALUE))
);

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()
.addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addContainerGap())
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
);

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

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


// TODO add your handling code here:
LOG_IN n = new LOG_IN();
n.setVisible(true);
this.setVisible(false);
}

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


// TODO add your handling code here:

private void JpasPass1ActionPerformed(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 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>

/* Create and display the form */


java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new REGISTER().setVisible(true);
}
});
}
// Variables declaration - do not modify
private javax.swing.JLabel JbEmail;
private javax.swing.JButton JbREGISTER;
private javax.swing.JLabel JbUser;
private javax.swing.JLabel Jbpass;
private javax.swing.JLabel Jbpass1;
private javax.swing.JLabel JlRegister;
private javax.swing.JPasswordField JpasPass1;
private javax.swing.JPasswordField JpassPass;
private javax.swing.JTextField JtxtEmail;
private javax.swing.JTextField JtxtUser;
private javax.swing.JLabel jLabel5;
private javax.swing.JLabel jLabel6;
private javax.swing.JPanel jPanel1;
// End of variables declaration
}

You might also like