A. Deskripsi
Aplikasi Tiket Bus
Aplikasi ini dibuat untuk memudahkan user ketika ingin mengetahui harga Tiket Bus sebelum memesan sehingga bisa mempersiapkan uang pas. Program ini cukup sederhana, Pengguna Tinggal pilih Rute Bus yang di tuju lalu akan muncul harga tiket satuan jikalau pengguna ingin membeli tiket lebih dari satu, pengguna tinggal menggunakan item Combobox yang berisi 1-4 lalu akan muncul harga total setelah itu centang kotak checkbox untuk mendapatkan diskon8% kemudian pengguna tekan tombol button utuk mengetahui harga yang harus dibayar, didalam aplikasi ini juga terdapat item - item sebagai berikut :
7 label
4 RadioButton
1 ButtonGrup
4 TextField
1 checkBox
1 Button
B. Flowchart
- Setelah itu beri nama Projectnya lalu klik finish
- Lalu Klik kanan pada project Tiket bus >New>JFrameFrome
Kemudian Desainlah Frame Seperti berikut :
- Lalu ubahlah Variabel Name dari item item yang ada di disain sebagai berikut :
JRadioButton1 = RB1 JComboBox = CmbJum
JRadioButton2 = RB2 JCheckBox = ChkDiskon
JRadioButton3 = RB3 Button = BtBayar
JRadioButton4 = RB4
Button Grup = BgTujuan
JTextfield1 = TxtHarga
JTextfield2 = TxtTotal
- Kemudian Akan Muncul Seperti Ini
- Jika Coding Yang Anda lakukan benar, Maka hasilnya akan seperti ini
D. Source Code
/*
* 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 TiketBus;
/**
*
* @author acer
*/
public class HargaTiketBus extends javax.swing.JFrame {
/**
* Creates new form HargaTiketBus
*/
public HargaTiketBus() {
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() {
BGtujuan = new javax.swing.ButtonGroup();
jLabel1 = new javax.swing.JLabel();
jLabel2 = new javax.swing.JLabel();
RB1 = new javax.swing.JRadioButton();
RB2 = new javax.swing.JRadioButton();
RB3 = new javax.swing.JRadioButton();
RB4 = new javax.swing.JRadioButton();
jLabel3 = new javax.swing.JLabel();
TxtHarga = new javax.swing.JTextField();
jLabel5 = new javax.swing.JLabel();
CmbJum = new javax.swing.JComboBox<>();
jLabel4 = new javax.swing.JLabel();
TxtTotal = new javax.swing.JTextField();
ChkDiskon = new javax.swing.JCheckBox();
TxtDiskon = new javax.swing.JTextField();
jLabel6 = new javax.swing.JLabel();
TxtBayar = new javax.swing.JTextField();
BtBayar = new javax.swing.JButton();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
jLabel1.setFont(new java.awt.Font("Times New Roman", 0, 18)); // NOI18N
jLabel1.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
jLabel1.setText("Info Harga Tiket Bus");
jLabel2.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
jLabel2.setText("Pilih Tujuan");
BGtujuan.add(RB1);
RB1.setText("Tangerang - Jakarta");
RB1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
RB1ActionPerformed(evt);
}
});
BGtujuan.add(RB2);
RB2.setText("Tangerang - Serang");
RB2.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
RB2ActionPerformed(evt);
}
});
BGtujuan.add(RB3);
RB3.setText("Tangerang - Bandung");
RB3.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
RB3ActionPerformed(evt);
}
});
BGtujuan.add(RB4);
RB4.setText("Tangerang - Lampung");
RB4.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
RB4ActionPerformed(evt);
}
});
jLabel3.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
jLabel3.setText("Harga");
jLabel5.setText("Jumlah Tiket");
CmbJum.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { " " }));
CmbJum.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
CmbJumActionPerformed(evt);
}
});
jLabel4.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
jLabel4.setText("Harga Total");
ChkDiskon.setText("Diskon 8%");
ChkDiskon.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
ChkDiskonActionPerformed(evt);
}
});
jLabel6.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
jLabel6.setText("Total Bayar");
BtBayar.setText("Bayar");
BtBayar.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
BtBayarActionPerformed(evt);
}
});
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(163, Short.MAX_VALUE)
.addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 181, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(151, 151, 151))
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(57, 57, 57)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(RB4)
.addComponent(RB3)
.addComponent(RB2)
.addComponent(RB1)))
.addGroup(layout.createSequentialGroup()
.addGap(66, 66, 66)
.addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 93, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(19, 19, 19)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel5, javax.swing.GroupLayout.PREFERRED_SIZE, 81, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel3, javax.swing.GroupLayout.PREFERRED_SIZE, 59, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel4, javax.swing.GroupLayout.PREFERRED_SIZE, 72, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addGap(10, 10, 10)
.addComponent(ChkDiskon, javax.swing.GroupLayout.PREFERRED_SIZE, 90, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(23, 23, 23)
.addComponent(CmbJum, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(layout.createSequentialGroup()
.addGap(18, 18, 18)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(TxtBayar, javax.swing.GroupLayout.PREFERRED_SIZE, 148, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(TxtDiskon, javax.swing.GroupLayout.PREFERRED_SIZE, 148, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(TxtHarga, javax.swing.GroupLayout.PREFERRED_SIZE, 148, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(TxtTotal, javax.swing.GroupLayout.PREFERRED_SIZE, 148, javax.swing.GroupLayout.PREFERRED_SIZE)))))
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addComponent(jLabel6, javax.swing.GroupLayout.PREFERRED_SIZE, 72, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(layout.createSequentialGroup()
.addGap(140, 140, 140)
.addComponent(BtBayar, javax.swing.GroupLayout.PREFERRED_SIZE, 103, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(24, 24, 24)
.addComponent(jLabel1)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 27, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(RB1)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(RB2)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(RB3)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(RB4)
.addGap(18, 18, 18)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel3, javax.swing.GroupLayout.PREFERRED_SIZE, 24, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(TxtHarga, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel5, javax.swing.GroupLayout.PREFERRED_SIZE, 23, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(CmbJum, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel4, javax.swing.GroupLayout.PREFERRED_SIZE, 24, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(TxtTotal, 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(ChkDiskon)
.addComponent(TxtDiskon, 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(jLabel6, javax.swing.GroupLayout.PREFERRED_SIZE, 24, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(TxtBayar, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(BtBayar, javax.swing.GroupLayout.DEFAULT_SIZE, 38, Short.MAX_VALUE)
.addGap(18, 18, 18))
);
pack();
}// </editor-fold>
private void RB3ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
if (RB3.isSelected()){
TxtHarga.setText("60000");
}
}
private void RB2ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
if (RB2.isSelected()){
TxtHarga.setText("35000");
}
}
private void RB1ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
if (RB1.isSelected()){
TxtHarga.setText("30000");
}
}
private void CmbJumActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
for(int i=1;i<5;i++){
CmbJum.addItem(""+i);
}
if (CmbJum.getSelectedItem().equals("1")){
TxtTotal.setText(TxtHarga.getText());
}
else if (CmbJum.getSelectedItem().equals("2")){
int harga = Integer.parseInt(TxtHarga.getText());
int total = harga*2 ;
TxtTotal.setText(Integer.toString(total));
}
else if (CmbJum.getSelectedItem().equals("3")){
int harga = Integer.parseInt(TxtHarga.getText());
int total = harga*3 ;
TxtTotal.setText(Integer.toString(total));
}
else if (CmbJum.getSelectedItem().equals("4")){
int harga = Integer.parseInt(TxtHarga.getText());
int total = harga*4 ;
TxtTotal.setText(Integer.toString(total));
}
}
private void RB4ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
if (RB4.isSelected()){
TxtHarga.setText("90000");
}
}
private void ChkDiskonActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
if (ChkDiskon.isSelected()){
int total = Integer.parseInt(TxtHarga.getText());
int diskon = total*8/100;
TxtDiskon.setText(Integer.toString(diskon));
}
}
private void BtBayarActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
//create variable
{
int angka1,angka2,hasil;
//input nilai
angka1 = Integer.parseInt(TxtTotal.getText());
angka2 = Integer.parseInt(TxtDiskon.getText());
//rumus
hasil = angka1 - angka2;
//output
TxtBayar.setText(Integer.toString(hasil));
}
}
/**
* @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(HargaTiketBus.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(HargaTiketBus.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(HargaTiketBus.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(HargaTiketBus.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 HargaTiketBus().setVisible(true);
}
});
}
// Variables declaration - do not modify
private javax.swing.ButtonGroup BGtujuan;
private javax.swing.JButton BtBayar;
private javax.swing.JCheckBox ChkDiskon;
private javax.swing.JComboBox<String> CmbJum;
private javax.swing.JRadioButton RB1;
private javax.swing.JRadioButton RB2;
private javax.swing.JRadioButton RB3;
private javax.swing.JRadioButton RB4;
private javax.swing.JTextField TxtBayar;
private javax.swing.JTextField TxtDiskon;
private javax.swing.JTextField TxtHarga;
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;
// End of variables declaration
}
Aplikasi Tiket Bus
Aplikasi ini dibuat untuk memudahkan user ketika ingin mengetahui harga Tiket Bus sebelum memesan sehingga bisa mempersiapkan uang pas. Program ini cukup sederhana, Pengguna Tinggal pilih Rute Bus yang di tuju lalu akan muncul harga tiket satuan jikalau pengguna ingin membeli tiket lebih dari satu, pengguna tinggal menggunakan item Combobox yang berisi 1-4 lalu akan muncul harga total setelah itu centang kotak checkbox untuk mendapatkan diskon8% kemudian pengguna tekan tombol button utuk mengetahui harga yang harus dibayar, didalam aplikasi ini juga terdapat item - item sebagai berikut :
7 label
4 RadioButton
1 ButtonGrup
4 TextField
1 checkBox
1 Button
B. Flowchart
C. Screen Shoot
Berikut Proses Pembuatan Aplikasi Info Tiket Bus :
Langkah awal anda harus membuat terlebih dahulu Project Baru
- Langkah pertama jalankan java NetBeans pada komputer
- Pilih File > New Project > Finish
- Setelah itu beri nama Projectnya lalu klik finish
- Lalu Klik kanan pada project Tiket bus >New>JFrameFrome
Kemudian Desainlah Frame Seperti berikut :
- Lalu ubahlah Variabel Name dari item item yang ada di disain sebagai berikut :
JRadioButton1 = RB1 JComboBox = CmbJum
JRadioButton2 = RB2 JCheckBox = ChkDiskon
JRadioButton3 = RB3 Button = BtBayar
JRadioButton4 = RB4
Button Grup = BgTujuan
JTextfield1 = TxtHarga
JTextfield2 = TxtTotal
JTextfield1 = TxtDiskon
JTextfield1 = TxtBayar
- Setelah Itu berikan Source Code, Yang nanti akan saya Sampaikan dibagian Akhir.
- Setelah Selesai proses Coding. Klik Run > Run File.
- Kemudian Akan Muncul Seperti Ini
- Jika Coding Yang Anda lakukan benar, Maka hasilnya akan seperti ini
/*
* 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 TiketBus;
/**
*
* @author acer
*/
public class HargaTiketBus extends javax.swing.JFrame {
/**
* Creates new form HargaTiketBus
*/
public HargaTiketBus() {
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() {
BGtujuan = new javax.swing.ButtonGroup();
jLabel1 = new javax.swing.JLabel();
jLabel2 = new javax.swing.JLabel();
RB1 = new javax.swing.JRadioButton();
RB2 = new javax.swing.JRadioButton();
RB3 = new javax.swing.JRadioButton();
RB4 = new javax.swing.JRadioButton();
jLabel3 = new javax.swing.JLabel();
TxtHarga = new javax.swing.JTextField();
jLabel5 = new javax.swing.JLabel();
CmbJum = new javax.swing.JComboBox<>();
jLabel4 = new javax.swing.JLabel();
TxtTotal = new javax.swing.JTextField();
ChkDiskon = new javax.swing.JCheckBox();
TxtDiskon = new javax.swing.JTextField();
jLabel6 = new javax.swing.JLabel();
TxtBayar = new javax.swing.JTextField();
BtBayar = new javax.swing.JButton();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
jLabel1.setFont(new java.awt.Font("Times New Roman", 0, 18)); // NOI18N
jLabel1.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
jLabel1.setText("Info Harga Tiket Bus");
jLabel2.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
jLabel2.setText("Pilih Tujuan");
BGtujuan.add(RB1);
RB1.setText("Tangerang - Jakarta");
RB1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
RB1ActionPerformed(evt);
}
});
BGtujuan.add(RB2);
RB2.setText("Tangerang - Serang");
RB2.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
RB2ActionPerformed(evt);
}
});
BGtujuan.add(RB3);
RB3.setText("Tangerang - Bandung");
RB3.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
RB3ActionPerformed(evt);
}
});
BGtujuan.add(RB4);
RB4.setText("Tangerang - Lampung");
RB4.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
RB4ActionPerformed(evt);
}
});
jLabel3.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
jLabel3.setText("Harga");
jLabel5.setText("Jumlah Tiket");
CmbJum.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { " " }));
CmbJum.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
CmbJumActionPerformed(evt);
}
});
jLabel4.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
jLabel4.setText("Harga Total");
ChkDiskon.setText("Diskon 8%");
ChkDiskon.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
ChkDiskonActionPerformed(evt);
}
});
jLabel6.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
jLabel6.setText("Total Bayar");
BtBayar.setText("Bayar");
BtBayar.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
BtBayarActionPerformed(evt);
}
});
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(163, Short.MAX_VALUE)
.addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 181, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(151, 151, 151))
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(57, 57, 57)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(RB4)
.addComponent(RB3)
.addComponent(RB2)
.addComponent(RB1)))
.addGroup(layout.createSequentialGroup()
.addGap(66, 66, 66)
.addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 93, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(19, 19, 19)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel5, javax.swing.GroupLayout.PREFERRED_SIZE, 81, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel3, javax.swing.GroupLayout.PREFERRED_SIZE, 59, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel4, javax.swing.GroupLayout.PREFERRED_SIZE, 72, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addGap(10, 10, 10)
.addComponent(ChkDiskon, javax.swing.GroupLayout.PREFERRED_SIZE, 90, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(23, 23, 23)
.addComponent(CmbJum, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(layout.createSequentialGroup()
.addGap(18, 18, 18)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(TxtBayar, javax.swing.GroupLayout.PREFERRED_SIZE, 148, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(TxtDiskon, javax.swing.GroupLayout.PREFERRED_SIZE, 148, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(TxtHarga, javax.swing.GroupLayout.PREFERRED_SIZE, 148, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(TxtTotal, javax.swing.GroupLayout.PREFERRED_SIZE, 148, javax.swing.GroupLayout.PREFERRED_SIZE)))))
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addComponent(jLabel6, javax.swing.GroupLayout.PREFERRED_SIZE, 72, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(layout.createSequentialGroup()
.addGap(140, 140, 140)
.addComponent(BtBayar, javax.swing.GroupLayout.PREFERRED_SIZE, 103, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(24, 24, 24)
.addComponent(jLabel1)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 27, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(RB1)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(RB2)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(RB3)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(RB4)
.addGap(18, 18, 18)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel3, javax.swing.GroupLayout.PREFERRED_SIZE, 24, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(TxtHarga, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel5, javax.swing.GroupLayout.PREFERRED_SIZE, 23, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(CmbJum, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel4, javax.swing.GroupLayout.PREFERRED_SIZE, 24, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(TxtTotal, 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(ChkDiskon)
.addComponent(TxtDiskon, 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(jLabel6, javax.swing.GroupLayout.PREFERRED_SIZE, 24, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(TxtBayar, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(BtBayar, javax.swing.GroupLayout.DEFAULT_SIZE, 38, Short.MAX_VALUE)
.addGap(18, 18, 18))
);
pack();
}// </editor-fold>
private void RB3ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
if (RB3.isSelected()){
TxtHarga.setText("60000");
}
}
private void RB2ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
if (RB2.isSelected()){
TxtHarga.setText("35000");
}
}
private void RB1ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
if (RB1.isSelected()){
TxtHarga.setText("30000");
}
}
private void CmbJumActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
for(int i=1;i<5;i++){
CmbJum.addItem(""+i);
}
if (CmbJum.getSelectedItem().equals("1")){
TxtTotal.setText(TxtHarga.getText());
}
else if (CmbJum.getSelectedItem().equals("2")){
int harga = Integer.parseInt(TxtHarga.getText());
int total = harga*2 ;
TxtTotal.setText(Integer.toString(total));
}
else if (CmbJum.getSelectedItem().equals("3")){
int harga = Integer.parseInt(TxtHarga.getText());
int total = harga*3 ;
TxtTotal.setText(Integer.toString(total));
}
else if (CmbJum.getSelectedItem().equals("4")){
int harga = Integer.parseInt(TxtHarga.getText());
int total = harga*4 ;
TxtTotal.setText(Integer.toString(total));
}
}
private void RB4ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
if (RB4.isSelected()){
TxtHarga.setText("90000");
}
}
private void ChkDiskonActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
if (ChkDiskon.isSelected()){
int total = Integer.parseInt(TxtHarga.getText());
int diskon = total*8/100;
TxtDiskon.setText(Integer.toString(diskon));
}
}
private void BtBayarActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
//create variable
{
int angka1,angka2,hasil;
//input nilai
angka1 = Integer.parseInt(TxtTotal.getText());
angka2 = Integer.parseInt(TxtDiskon.getText());
//rumus
hasil = angka1 - angka2;
//output
TxtBayar.setText(Integer.toString(hasil));
}
}
/**
* @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(HargaTiketBus.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(HargaTiketBus.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(HargaTiketBus.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(HargaTiketBus.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 HargaTiketBus().setVisible(true);
}
});
}
// Variables declaration - do not modify
private javax.swing.ButtonGroup BGtujuan;
private javax.swing.JButton BtBayar;
private javax.swing.JCheckBox ChkDiskon;
private javax.swing.JComboBox<String> CmbJum;
private javax.swing.JRadioButton RB1;
private javax.swing.JRadioButton RB2;
private javax.swing.JRadioButton RB3;
private javax.swing.JRadioButton RB4;
private javax.swing.JTextField TxtBayar;
private javax.swing.JTextField TxtDiskon;
private javax.swing.JTextField TxtHarga;
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;
// End of variables declaration
}
Your Affiliate Money Printing Machine is ready -
ReplyDeletePlus, making money online using it is as simple as 1 . 2 . 3!
Here's how it all works...
STEP 1. Choose which affiliate products the system will promote
STEP 2. Add PUSH button traffic (it LITERALLY takes 2 minutes)
STEP 3. See how the system explode your list and up-sell your affiliate products all on it's own!
Are you ready to make money ONLINE?
You can test-drive the system for yourself risk free...