Saya Mahasiswa STMIK ERESHA ingin coba berexperimen membuat aplikasi sederhana.
Deskripsi Aplikasi
Dengan semakin banyaknya peminat penonton bioskop disini saya mencoba untuk membuat satu aplikasi sederhana E-TIX untuk memudahkan para calon penonton agar tidak mengantri dengan menggunakan maka dari itu saya membuat aplikasi E-TIX di JAVA Netbeans.
Flowchart
Form Run
Source Code
Buka Aplikasi Netbeans, Open file lalu New Project -> JAVA Application -> Lalu buat JFrame Form dengan nama Frame_Penjualan_Tiket_Bioskop lalu buat codingannya :
/*
* 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.
*/
package program.tiket.bioskop;
/**
*
* @author Acer
*/
public class Frame_Penjualan_Tiket_Bioskop extends javax.swing.JFrame {
/**
* Creates new form Frame_Penjualan_Tiket_Bioskop
*/
public Frame_Penjualan_Tiket_Bioskop() {
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() {
jLabel1 = new javax.swing.JLabel();
jLabel2 = new javax.swing.JLabel();
NoTiket = new javax.swing.JTextField();
jLabel3 = new javax.swing.JLabel();
Regular = new javax.swing.JRadioButton();
Deluxe = new javax.swing.JRadioButton();
Premiere = new javax.swing.JRadioButton();
IMAX = new javax.swing.JRadioButton();
Harga = new javax.swing.JLabel();
HargaSatuan = new javax.swing.JTextField();
jLabel4 = new javax.swing.JLabel();
JumlahBeli = new javax.swing.JTextField();
btnProses = new javax.swing.JButton();
btnHapus = new javax.swing.JButton();
jLabel5 = new javax.swing.JLabel();
totalBayar = new javax.swing.JTextField();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
jLabel1.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N
jLabel1.setText("Penjualan Tiket Bioskop E-TIX");
jLabel2.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N
jLabel2.setText("No. Tiket");
NoTiket.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N
jLabel3.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N
jLabel3.setText("Jenis Tiket");
Regular.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N
Regular.setText("Regular");
Regular.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
RegularActionPerformed(evt);
}
});
Deluxe.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N
Deluxe.setText("Deluxe");
Deluxe.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
DeluxeActionPerformed(evt);
}
});
Premiere.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N
Premiere.setText("Premiere");
Premiere.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
PremiereActionPerformed(evt);
}
});
IMAX.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N
IMAX.setText("IMAX");
IMAX.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
IMAXActionPerformed(evt);
}
});
Harga.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N
Harga.setText("Harga");
jLabel4.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N
jLabel4.setText("Jumlah Beli");
btnProses.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N
btnProses.setText("Proses");
btnProses.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btnProsesActionPerformed(evt);
}
});
btnHapus.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N
btnHapus.setText("Hapus");
btnHapus.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btnHapusActionPerformed(evt);
}
});
jLabel5.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N
jLabel5.setText("Total Bayar");
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(25, 25, 25)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel2)
.addComponent(jLabel3)
.addComponent(Harga)
.addComponent(jLabel4)))
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addComponent(jLabel5)))
.addGap(64, 64, 64)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(NoTiket, javax.swing.GroupLayout.PREFERRED_SIZE, 207, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(Regular)
.addComponent(Premiere))
.addGap(49, 49, 49)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(Deluxe)
.addComponent(IMAX)))
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
.addComponent(totalBayar, javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addComponent(btnProses)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 29, Short.MAX_VALUE)
.addComponent(btnHapus))
.addComponent(JumlahBeli, javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(HargaSatuan, javax.swing.GroupLayout.Alignment.LEADING)))
.addContainerGap(31, Short.MAX_VALUE))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addGap(0, 0, Short.MAX_VALUE)
.addComponent(jLabel1)
.addGap(95, 95, 95))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 22, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel2)
.addComponent(NoTiket, 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.Alignment.BASELINE)
.addComponent(jLabel3)
.addComponent(Regular)
.addComponent(Deluxe))
.addGap(29, 29, 29)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(Premiere)
.addComponent(IMAX))
.addGap(33, 33, 33)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(Harga)
.addComponent(HargaSatuan, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(23, 23, 23)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel4)
.addComponent(JumlahBeli, 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.Alignment.BASELINE)
.addComponent(btnProses)
.addComponent(btnHapus))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 26, Short.MAX_VALUE)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel5)
.addComponent(totalBayar, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(49, 49, 49))
);
pack();
}// </editor-fold>
private void RegularActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
HargaSatuan.setText("50000");
}
private void DeluxeActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
HargaSatuan.setText("60000");
}
private void PremiereActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
HargaSatuan.setText("80000");
}
private void IMAXActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
HargaSatuan.setText("70000");
}
private void btnProsesActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
int c = Integer.parseInt(HargaSatuan.getText());
int d = Integer.parseInt(JumlahBeli.getText());
int hasilnya = c*d;
totalBayar.setText("Rp. "+hasilnya);
}
private void btnHapusActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
NoTiket.setText("");
JumlahBeli.setText("");
HargaSatuan.setText("");
totalBayar.setText("");
Regular.setSelected(false);
Deluxe.setSelected(false);
Regular.setSelected(true);
Deluxe.setSelected(true);
}
/**
* @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(Frame_Penjualan_Tiket_Bioskop.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(Frame_Penjualan_Tiket_Bioskop.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(Frame_Penjualan_Tiket_Bioskop.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(Frame_Penjualan_Tiket_Bioskop.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 Frame_Penjualan_Tiket_Bioskop().setVisible(true);
}
});
}
// Variables declaration - do not modify
private javax.swing.JRadioButton Deluxe;
private javax.swing.JLabel Harga;
private javax.swing.JTextField HargaSatuan;
private javax.swing.JRadioButton IMAX;
private javax.swing.JTextField JumlahBeli;
private javax.swing.JTextField NoTiket;
private javax.swing.JRadioButton Premiere;
private javax.swing.JRadioButton Regular;
private javax.swing.JButton btnHapus;
private javax.swing.JButton btnProses;
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.JTextField totalBayar;
// End of variables declaration
}
Terima Kasih Semoga Bermanfaat Untuk Kita Semua.
No comments:
Post a Comment