Source code aplikasi kasir menggunakan netBeans (jframe)

Assalamu’alaikum..wr..wb…

Oke guys kali ini cara membuat aplikasi pemrograman aplikasi kasir murah dengan menggunakan aplikasi netBeans ID 8.2 berikut source code aplikasi kasir.

Aplikasi kasir ini di buat untuk mempermudah suatu pekerjaan, waktu lebih efesien.

Dalam penjualan biasanya di pakai aplikasi kasir yang sekarang kita akan buat.

Aplikasi di perlukan di berbagai bidang usaha online maupun offline.

ada banyak plugin diperlukan

Untuk membuat aplikasi kasir ini teman-teman download terlebih dahulu aplikasi netbeans

source code aplikasi kasir ni guys Langkah pertama kita harus download app NetBeansnya, setelah terdownload langsung aja install appnya.

Untuk install silakan klik dua kali aplikasi netbeans untuk install.

buka app netBeansnya lalu klik file pilih new project, lalu pilih java dan klik next lalu kita masukan nama projectnya dan finish.

Langkah selanjutnya klik kanan pada project yang tadi kita buat, pilih new dan pilih jFrame form… seperti gambar berikut..!!

Naah sekarang kita mulai dengan membuat desainnya. saya membuat desain ini dengan menggunakan swing controls label, combo box, text filed, button, radio button, check box.

-Nama kasir caffe bingung, nama makanan, harga makanan, jumlah beli, jumlah harga, jumlah bayar, dan jumlah kembalian kita menggunakan swing controls label,

-pilihan menu menggunakan combo box

kolom kosong pada harga makanan, jumlah beli,jumlah harga,jumlah bayar, dan jumlah kembalian menggunakan swing controls text filed

-hitung jumlah harga, bayar, batal, keluar menggunakan button

-bungkus, makan disini menggunakan radio button.

-pph menggunakan check box.

Oia, cara mengganti nama swing controls tersebut dengan cara klik kanan pada swing control yang ingin di ganti namanya lalu klik edit text lalu enter

Untuk mengganti nama menu makanan pada combo box caranya klik kanan pada kolom combo box > propertis > pilih model lalu ganti dengan sesuai menu anda.

ini codingan semuanya:
/*
* 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 ezza;
import java.text.NumberFormat;
import java.util.StringTokenizer;
import java.util.Locale;
import javax.swing.JOptionPane;
/**
*
* @author User
*/
public class eza2 extends javax.swing.JFrame {
///StringTokenizer token;
//String gantiformat=””;
String nm_mknan=””;
int harga_mknan;
int jml_beli;
int jumlah_hrg;
int kembalian;
int jumlah_byr;
int bayar,beli,Harga,bungkus;
/**
* Creates new form eza2
*/
public eza2() {
initComponents();
}
public void radio(){
if(rdBungkus.isSelected()){
bungkus = bayar + 2000 ;
txtHarga.setText(“”+bungkus);
}else{
txtHarga.setText(“”+bayar);
}
}
/**
* 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() {
buttonGroup1 = new javax.swing.ButtonGroup();
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();
CBNNamaMkn = new javax.swing.JComboBox<>();
txtharga = new javax.swing.JTextField();
txtBeli = new javax.swing.JTextField();
txtHarga = new javax.swing.JTextField();
txtBayar = new javax.swing.JTextField();
jButton1 = new javax.swing.JButton();
TmtjmlBayar = new javax.swing.JButton();
jButton3 = new javax.swing.JButton();
jLabel7 = new javax.swing.JLabel();
Txtkembalian = new javax.swing.JTextField();
jTotal = new javax.swing.JButton();
rdBungkus = new javax.swing.JRadioButton();
buttonGroup1.add(rdBungkus);
rdDisini = new javax.swing.JRadioButton();
buttonGroup1.add(rdDisini);
jBonus = new javax.swing.JCheckBox();
jLabel8 = new javax.swing.JLabel();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
setBackground(new java.awt.Color(0, 51, 204));
setForeground(new java.awt.Color(0, 51, 204));
jLabel1.setFont(new java.awt.Font(“Tahoma”, 1, 11)); // NOI18N
jLabel1.setForeground(new java.awt.Color(204, 0, 0));
jLabel1.setText(“NAMA MAKANAN”);
jLabel2.setFont(new java.awt.Font(“Tahoma”, 1, 11)); // NOI18N
jLabel2.setForeground(new java.awt.Color(204, 0, 0));
jLabel2.setText(“HARGA MAKANAN”);
jLabel3.setFont(new java.awt.Font(“Tahoma”, 1, 11)); // NOI18N
jLabel3.setForeground(new java.awt.Color(204, 0, 0));
jLabel3.setText(“JUMLAH BELI”);
jLabel4.setFont(new java.awt.Font(“Tahoma”, 1, 11)); // NOI18N
jLabel4.setForeground(new java.awt.Color(204, 0, 0));
jLabel4.setText(“JUMLAH HARGA”);
jLabel5.setFont(new java.awt.Font(“Tahoma”, 1, 11)); // NOI18N
jLabel5.setForeground(new java.awt.Color(255, 0, 0));
jLabel5.setText(“JUMLAH BAYAR”);
CBNNamaMkn.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { “PILIH MENU”, “Ayam bakar”, “Sate ayam”, “Soto ayam”, “Rendang”, “Es teh manis”, “Teh manis” }));
CBNNamaMkn.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
CBNNamaMknActionPerformed(evt);
}
});
txtharga.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
txthargaActionPerformed(evt);
}
});
txtHarga.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
txtHargaActionPerformed(evt);
}
});
txtBayar.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
txtBayarActionPerformed(evt);
}
});
jButton1.setFont(new java.awt.Font(“Tahoma”, 1, 11)); // NOI18N
jButton1.setText(“BATAL”);
jButton1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton1ActionPerformed(evt);
}
});
TmtjmlBayar.setFont(new java.awt.Font(“Tahoma”, 1, 11)); // NOI18N
TmtjmlBayar.setText(“HITUNG JUMLAH HARGA”);
TmtjmlBayar.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
TmtjmlBayarActionPerformed(evt);
}
});
jButton3.setFont(new java.awt.Font(“Tahoma”, 1, 11)); // NOI18N
jButton3.setText(“KELUAR”);
jButton3.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton3ActionPerformed(evt);
}
});
jLabel7.setFont(new java.awt.Font(“Tahoma”, 1, 11)); // NOI18N
jLabel7.setForeground(new java.awt.Color(255, 0, 0));
jLabel7.setText(“JUMLAH KEMBALIAN”);
jTotal.setFont(new java.awt.Font(“Tahoma”, 1, 11)); // NOI18N
jTotal.setText(“Bayar”);
jTotal.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jTotalActionPerformed(evt);
}
});
rdBungkus.setText(“Bungkus”);
rdBungkus.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
rdBungkusActionPerformed(evt);
}
});
rdDisini.setText(“Makan Disini”);
rdDisini.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
rdDisiniActionPerformed(evt);
}
});
jBonus.setText(“pph 10%”);
jBonus.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jBonusActionPerformed(evt);
}
});
jLabel8.setFont(new java.awt.Font(“Wide Latin”, 1, 14)); // NOI18N
jLabel8.setForeground(new java.awt.Color(255, 51, 0));
jLabel8.setText(“(*_*)KASIR CAFFE ”BINGUNG”(*_*)”);
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()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
.addComponent(jLabel2, javax.swing.GroupLayout.DEFAULT_SIZE, 107, Short.MAX_VALUE)
.addComponent(jLabel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addComponent(jLabel6))
.addGap(0, 0, Short.MAX_VALUE))
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel5)
.addComponent(jLabel4)
.addComponent(jLabel3)
.addComponent(jLabel7))
.addGap(35, 35, 35)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(67, 67, 67)
.addComponent(jBonus))
.addGroup(layout.createSequentialGroup()
.addGap(73, 73, 73)
.addComponent(jTotal)))
.addGap(0, 0, Short.MAX_VALUE))
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addComponent(rdBungkus)
.addGap(18, 18, 18)
.addComponent(rdDisini))
.addComponent(CBNNamaMkn, javax.swing.GroupLayout.PREFERRED_SIZE, 231, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(Txtkembalian, javax.swing.GroupLayout.PREFERRED_SIZE, 231, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
.addComponent(txtBayar, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 231, Short.MAX_VALUE)
.addComponent(txtHarga, javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(txtharga, javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(txtBeli, javax.swing.GroupLayout.Alignment.LEADING)))
.addGap(54, 54, 54)
.addComponent(jButton1)
.addGap(92, 92, 92)
.addComponent(jButton3)))
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))))))
.addGroup(layout.createSequentialGroup()
.addGap(187, 187, 187)
.addComponent(TmtjmlBayar)
.addGap(0, 0, Short.MAX_VALUE))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addContainerGap(190, Short.MAX_VALUE)
.addComponent(jLabel8)
.addGap(143, 143, 143))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addComponent(jLabel8, javax.swing.GroupLayout.PREFERRED_SIZE, 54, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 17, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(CBNNamaMkn, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(21, 21, 21)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(txtharga, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel2))
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(14, 14, 14)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel3)
.addComponent(txtBeli, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addGroup(layout.createSequentialGroup()
.addGap(5, 5, 5)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jButton3)
.addComponent(jButton1))))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(TmtjmlBayar)
.addGap(1, 1, 1)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(txtHarga, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel4))
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(98, 98, 98)
.addComponent(jLabel6))
.addGroup(layout.createSequentialGroup()
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(rdBungkus)
.addComponent(rdDisini))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(txtBayar, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel5, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(8, 8, 8)
.addComponent(jTotal)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel7)
.addComponent(Txtkembalian, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jBonus)
.addContainerGap(19, Short.MAX_VALUE))
);
pack();
}// </editor-fold>
private void CBNNamaMknActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
nm_mknan=(String)CBNNamaMkn.getSelectedItem();
if(nm_mknan==”Ayam bakar”)
{
harga_mknan=20000;
}else if (nm_mknan==”Sate ayam”)
{
harga_mknan=30000;
}else if (nm_mknan==”Soto ayam”)
{
harga_mknan=15000;
}else if (nm_mknan==”Rendang”)
{
harga_mknan=30000;
}else if (nm_mknan==”Es teh manis”)
{
harga_mknan=10000;
}else if (nm_mknan==”Teh manis”)
{
harga_mknan=8500;
}
//gantiformat=NumberFormat.getNumberInstance(Locale.ENGLISH).format(harga_mknan);
//token=new StringTokenizer(gantiformat,”.”);
//gantiformat=token.nextToken();
//gantiformat=gantiformat.replace(‘.’,’.’ );
txtharga.setText(“”+harga_mknan);
}
private void TmtjmlBayarActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
Harga =Integer.parseInt(txtharga.getText());
beli = Integer.parseInt(txtBeli.getText());
bayar = Harga * beli ;
txtHarga.setText(“”+bayar);
//gantiformat=NumberFormat.getNumberInstance(Locale.ENGLISH).format(jumlah_byr);
///token=new StringTokenizer(gantiformat,”.”);
//gantiformat=token.nextToken();
//gantiformat=gantiformat.replace(‘.’,’.’ );
//txtBayar.setText(gantiformat);
//gantiformat=NumberFormat.getNumberInstance(Locale.ENGLISH).format(kembalian);
//token=new StringTokenizer(gantiformat,”.”);
//gantiformat=token.nextToken();
//gantiformat=gantiformat.replace(‘.’,’.’ );
//Txtkembalian.setText(gantiformat);
}
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:’
int answer = JOptionPane.showConfirmDialog(null, “Yakin anda ingin membatalkan pesanan”, “Selesai”, JOptionPane.OK_OPTION);
if (answer == JOptionPane.OK_OPTION)
buttonGroup1.clearSelection();
CBNNamaMkn.setSelectedIndex(-1);
txtharga.setText(“”);
txtBeli.setText(“”);
txtBayar.setText(“”);
txtHarga.setText(“”);
Txtkembalian.setText(“”);
}
private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
int answer = JOptionPane.showConfirmDialog(null, “Apakah anda ingin keluar”, “Selesai”, JOptionPane.OK_OPTION);
if (answer == JOptionPane.OK_OPTION){
dispose();
}
}
private void txtBayarActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
}
private void txtHargaActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
}
private void jTotalActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
int duit = Integer.parseInt(txtBayar.getText());
int kembali = duit – bayar;
if(rdBungkus.isSelected()){
kembali = kembali – 2000;
}
Txtkembalian.setText(“”+kembali);
}
private void rdBungkusActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
radio();
}
private void rdDisiniActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
radio();
}
private void jBonusActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
if(jBonus.isSelected()){
bayar = bayar / 10;
}
Txtkembalian.setText(“”+bayar);
}
private void txthargaActionPerformed(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(eza2.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(eza2.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(eza2.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(eza2.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() {
JOptionPane.showMessageDialog(null, “Perhitungan Kasir CAFFE BINGUNG”);
new eza2().setVisible(true);
}
});
}
// Variables declaration – do not modify
private javax.swing.JComboBox<String> CBNNamaMkn;
private javax.swing.JButton TmtjmlBayar;
private javax.swing.JTextField Txtkembalian;
private javax.swing.ButtonGroup buttonGroup1;
private javax.swing.JCheckBox jBonus;
private javax.swing.JButton jButton1;
private javax.swing.JButton jButton3;
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.JButton jTotal;
private javax.swing.JRadioButton rdBungkus;
private javax.swing.JRadioButton rdDisini;
private javax.swing.JTextField txtBayar;
private javax.swing.JTextField txtBeli;
private javax.swing.JTextField txtHarga;
private javax.swing.JTextField txtharga;
// End of variables declaration
}

Sekian untuk blog saya kali ini, kurang dan lebihnya saya mohon maaf.. dan semoga bermanfaat.

Wassalamualaikum..wr..wb…

Jasa Interior Jakarta Barat

Tinggalkan Balasan

Alamat email Anda tidak akan dipublikasikan. Ruas yang wajib ditandai *