Tugas Teknik Informatika
Program Mesin Kasir PenjualanTV Elektronik
A. Deskripsi Aplikasi
Program ini merupakan program sederhana mesin kasir penjualan elekstronik. Program ini
dibuat menggunakan software Java NetBeans dengan bahasa Java. Program Mesin Kasir ini
digunakan untuk mempercepat proses penghitungan jumlah pembayaran ketika kita
berbelanja di suatu toko yang kemudian akan menghasilkan keluaran berupa hasil belanjaan. Nah sekarang tunggu apa lagi mari simak terus tugas saya ini ya .
B. Komponen, Variabel dan Rumus
1. Main class : Frame Penjualan Tv Sederhana
2. Javax.swing.Jlabel
3. Javax.swing.JButton
4. Javax.swing.JFrame
5. Deklarsi :
- Int harga, jumlah beli, hasil;
- Total, bayar,;
- String ;
6. Komponen dalam Program:
- Jlabel
- JRadioButton
- JButton
7. Rumus :
a. Subtotal = harga * jumlah beli;
Total bayar/Hasil
C.Flowchart
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 program.kasir.tv;
import javax.swing.JOptionPane;
/**
*
* @author User
*/
public class ProgramTV extends javax.swing.JFrame {
/**
* Creates new form ProgramTV
*/
public ProgramTV() {
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();
Cmb_Barang = new javax.swing.JComboBox<>();
jLabel2 = new javax.swing.JLabel();
jLabel3 = new javax.swing.JLabel();
jLabel4 = new javax.swing.JLabel();
Btn_Hitung = new javax.swing.JButton();
Btn_Hapus = new javax.swing.JButton();
Btn_Exit = new javax.swing.JButton();
Jml_Barang = new javax.swing.JTextField();
Hrg_Barang = new javax.swing.JTextField();
Jml = new javax.swing.JTextField();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
addComponentListener(new java.awt.event.ComponentAdapter() {
public void componentShown(java.awt.event.ComponentEvent evt) {
formComponentShown(evt);
}
});
jLabel1.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N
jLabel1.setText("ELEKTRONIK TELEVISI");
jLabel1.setToolTipText("");
Cmb_Barang.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "Pilihan", "Samsung", "LG", "Sharp" }));
Cmb_Barang.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
Cmb_BarangActionPerformed(evt);
}
});
jLabel2.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
jLabel2.setText("Jumlah Barang");
jLabel3.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
jLabel3.setText("Harga Barang");
jLabel4.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
jLabel4.setText("Jumlah");
Btn_Hitung.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
Btn_Hitung.setText("Hitung");
Btn_Hitung.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
Btn_HitungActionPerformed(evt);
}
});
Btn_Hapus.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
Btn_Hapus.setText("Hapus");
Btn_Hapus.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
Btn_HapusActionPerformed(evt);
}
});
Btn_Exit.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
Btn_Exit.setText("Exit");
Btn_Exit.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
Btn_ExitActionPerformed(evt);
}
});
Jml_Barang.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
Jml_BarangActionPerformed(evt);
}
});
Hrg_Barang.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
Hrg_BarangActionPerformed(evt);
}
});
Jml.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
JmlActionPerformed(evt);
}
});
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(136, 136, 136)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(Cmb_Barang, javax.swing.GroupLayout.PREFERRED_SIZE, 172, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(jLabel4, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jLabel2, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 86, Short.MAX_VALUE)
.addComponent(jLabel3, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addGap(295, 295, 295)
.addComponent(Btn_Exit))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addComponent(jLabel1)
.addGap(259, 259, 259))))
.addGroup(layout.createSequentialGroup()
.addGap(270, 270, 270)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(Btn_Hitung)
.addComponent(Jml_Barang)
.addComponent(Hrg_Barang)
.addComponent(Jml, javax.swing.GroupLayout.DEFAULT_SIZE, 109, Short.MAX_VALUE))
.addGap(16, 16, 16)
.addComponent(Btn_Hapus)))
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addComponent(jLabel1)
.addGap(45, 45, 45)
.addComponent(Cmb_Barang, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(50, 50, 50)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel3, javax.swing.GroupLayout.PREFERRED_SIZE, 26, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(Hrg_Barang, 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(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 29, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(Jml_Barang))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel4, javax.swing.GroupLayout.PREFERRED_SIZE, 34, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(Jml, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 27, Short.MAX_VALUE)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(Btn_Hapus)
.addComponent(Btn_Hitung))
.addGap(112, 112, 112))
.addGroup(layout.createSequentialGroup()
.addGap(36, 36, 36)
.addComponent(Btn_Exit)
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
pack();
}// </editor-fold>
private void Cmb_BarangActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
int harga = 0;
if (Cmb_Barang.getSelectedItem() == "--PILIHAN--") {
Jml_Barang.setText("");
Hrg_Barang.setText("");
Jml.setText("");
Jml_Barang.setEnabled(false);
Hrg_Barang.setEnabled(false);
Jml.setEnabled(false);
Cmb_Barang.requestFocus();
} else {
Jml_Barang.setEnabled(true);
Hrg_Barang.setEnabled(true);
Jml.setEnabled(true);
Cmb_Barang.requestFocus();
if (Cmb_Barang.getSelectedItem() == "Samsung") {
harga = 2500000;
} else if (Cmb_Barang.getSelectedItem() == "LG") {
harga = 2700000;
} else if (Cmb_Barang.getSelectedItem() == "Sharp") {
harga = 2000000;
}
}
Hrg_Barang.setText(String.valueOf(harga));
if (Cmb_Barang.getSelectedItem() == "Samsung") {
System.out.println("2500000");
} else if (Cmb_Barang.getSelectedItem() == "LG") {
System.out.println("2700000");
} else {
System.out.println("2000000");
}
}
private void Btn_HitungActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
{
int total = 0;
int a = Integer.parseInt(Jml_Barang.getText());
int b = Integer.parseInt(Hrg_Barang.getText());
int hasilnya = a * b;
Jml.setText("Rp." + hasilnya);
}
}
private void Btn_HapusActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
//Jml_Barang.setEditable(false);
Jml_Barang.setText("");
//Hrg_Barang.setEditable(false);
Hrg_Barang.setText("");
//Jml.setEditable(false);
Jml.setText("");
}
private void Btn_ExitActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
{
JOptionPane.showMessageDialog(null, "Terimakasih Telah Berbelanja Di Toko Abang Jeeeps");
}
System.exit(0);
}
private void formComponentShown(java.awt.event.ComponentEvent evt) {
// TODO add your handling code here:
}
private void Jml_BarangActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
}
private void Hrg_BarangActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
}
private void JmlActionPerformed(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(ProgramTV.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(ProgramTV.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(ProgramTV.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(ProgramTV.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 ProgramTV().setVisible(true);
}
});
}
// Variables declaration - do not modify
private javax.swing.JButton Btn_Exit;
private javax.swing.JButton Btn_Hapus;
private javax.swing.JButton Btn_Hitung;
private javax.swing.JComboBox<String> Cmb_Barang;
private javax.swing.JTextField Hrg_Barang;
private javax.swing.JTextField Jml;
private javax.swing.JTextField Jml_Barang;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel3;
private javax.swing.JLabel jLabel4;
// End of variables declaration
}
* 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.kasir.tv;
import javax.swing.JOptionPane;
/**
*
* @author User
*/
public class ProgramTV extends javax.swing.JFrame {
/**
* Creates new form ProgramTV
*/
public ProgramTV() {
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();
Cmb_Barang = new javax.swing.JComboBox<>();
jLabel2 = new javax.swing.JLabel();
jLabel3 = new javax.swing.JLabel();
jLabel4 = new javax.swing.JLabel();
Btn_Hitung = new javax.swing.JButton();
Btn_Hapus = new javax.swing.JButton();
Btn_Exit = new javax.swing.JButton();
Jml_Barang = new javax.swing.JTextField();
Hrg_Barang = new javax.swing.JTextField();
Jml = new javax.swing.JTextField();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
addComponentListener(new java.awt.event.ComponentAdapter() {
public void componentShown(java.awt.event.ComponentEvent evt) {
formComponentShown(evt);
}
});
jLabel1.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N
jLabel1.setText("ELEKTRONIK TELEVISI");
jLabel1.setToolTipText("");
Cmb_Barang.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "Pilihan", "Samsung", "LG", "Sharp" }));
Cmb_Barang.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
Cmb_BarangActionPerformed(evt);
}
});
jLabel2.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
jLabel2.setText("Jumlah Barang");
jLabel3.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
jLabel3.setText("Harga Barang");
jLabel4.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
jLabel4.setText("Jumlah");
Btn_Hitung.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
Btn_Hitung.setText("Hitung");
Btn_Hitung.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
Btn_HitungActionPerformed(evt);
}
});
Btn_Hapus.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
Btn_Hapus.setText("Hapus");
Btn_Hapus.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
Btn_HapusActionPerformed(evt);
}
});
Btn_Exit.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
Btn_Exit.setText("Exit");
Btn_Exit.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
Btn_ExitActionPerformed(evt);
}
});
Jml_Barang.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
Jml_BarangActionPerformed(evt);
}
});
Hrg_Barang.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
Hrg_BarangActionPerformed(evt);
}
});
Jml.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
JmlActionPerformed(evt);
}
});
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(136, 136, 136)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(Cmb_Barang, javax.swing.GroupLayout.PREFERRED_SIZE, 172, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(jLabel4, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jLabel2, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 86, Short.MAX_VALUE)
.addComponent(jLabel3, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addGap(295, 295, 295)
.addComponent(Btn_Exit))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addComponent(jLabel1)
.addGap(259, 259, 259))))
.addGroup(layout.createSequentialGroup()
.addGap(270, 270, 270)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(Btn_Hitung)
.addComponent(Jml_Barang)
.addComponent(Hrg_Barang)
.addComponent(Jml, javax.swing.GroupLayout.DEFAULT_SIZE, 109, Short.MAX_VALUE))
.addGap(16, 16, 16)
.addComponent(Btn_Hapus)))
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addComponent(jLabel1)
.addGap(45, 45, 45)
.addComponent(Cmb_Barang, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(50, 50, 50)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel3, javax.swing.GroupLayout.PREFERRED_SIZE, 26, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(Hrg_Barang, 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(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 29, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(Jml_Barang))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel4, javax.swing.GroupLayout.PREFERRED_SIZE, 34, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(Jml, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 27, Short.MAX_VALUE)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(Btn_Hapus)
.addComponent(Btn_Hitung))
.addGap(112, 112, 112))
.addGroup(layout.createSequentialGroup()
.addGap(36, 36, 36)
.addComponent(Btn_Exit)
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
pack();
}// </editor-fold>
private void Cmb_BarangActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
int harga = 0;
if (Cmb_Barang.getSelectedItem() == "--PILIHAN--") {
Jml_Barang.setText("");
Hrg_Barang.setText("");
Jml.setText("");
Jml_Barang.setEnabled(false);
Hrg_Barang.setEnabled(false);
Jml.setEnabled(false);
Cmb_Barang.requestFocus();
} else {
Jml_Barang.setEnabled(true);
Hrg_Barang.setEnabled(true);
Jml.setEnabled(true);
Cmb_Barang.requestFocus();
if (Cmb_Barang.getSelectedItem() == "Samsung") {
harga = 2500000;
} else if (Cmb_Barang.getSelectedItem() == "LG") {
harga = 2700000;
} else if (Cmb_Barang.getSelectedItem() == "Sharp") {
harga = 2000000;
}
}
Hrg_Barang.setText(String.valueOf(harga));
if (Cmb_Barang.getSelectedItem() == "Samsung") {
System.out.println("2500000");
} else if (Cmb_Barang.getSelectedItem() == "LG") {
System.out.println("2700000");
} else {
System.out.println("2000000");
}
}
private void Btn_HitungActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
{
int total = 0;
int a = Integer.parseInt(Jml_Barang.getText());
int b = Integer.parseInt(Hrg_Barang.getText());
int hasilnya = a * b;
Jml.setText("Rp." + hasilnya);
}
}
private void Btn_HapusActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
//Jml_Barang.setEditable(false);
Jml_Barang.setText("");
//Hrg_Barang.setEditable(false);
Hrg_Barang.setText("");
//Jml.setEditable(false);
Jml.setText("");
}
private void Btn_ExitActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
{
JOptionPane.showMessageDialog(null, "Terimakasih Telah Berbelanja Di Toko Abang Jeeeps");
}
System.exit(0);
}
private void formComponentShown(java.awt.event.ComponentEvent evt) {
// TODO add your handling code here:
}
private void Jml_BarangActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
}
private void Hrg_BarangActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
}
private void JmlActionPerformed(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(ProgramTV.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(ProgramTV.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(ProgramTV.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(ProgramTV.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 ProgramTV().setVisible(true);
}
});
}
// Variables declaration - do not modify
private javax.swing.JButton Btn_Exit;
private javax.swing.JButton Btn_Hapus;
private javax.swing.JButton Btn_Hitung;
private javax.swing.JComboBox<String> Cmb_Barang;
private javax.swing.JTextField Hrg_Barang;
private javax.swing.JTextField Jml;
private javax.swing.JTextField Jml_Barang;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel3;
private javax.swing.JLabel jLabel4;
// End of variables declaration
}
Terimakasih
Komentar
Posting Komentar