Kasir Penjualan Leptop
Nih Ada lagi masih setia sama itung-itungan ni..…
Desain Tampilan yang udah di desain nih…
Palette yang di perluin nih…
1.
Label
2.
Button
3.
Check Box
4.
Radio Button
5.
Button group..
“Change Variable Name” diganti ya mengikuti
nih..
JButton1------ btnHitung
JButton2------ btnKosong
JCheckBox1 ------chkAcer
JCheckBox2 ------chkAxioo
JCheckBox3 ------chkCompek
JCheckBox4-------chkSamsung
JLabel1---------lblCaraBayar
JLabel2--------- lblTotal
ButtonGroup1------ rdgCaraBayar
JRadioButton1------ rdoBCACard
JRadioButton2------ rdoCash
JRadioButton3------ rdoMandiri
JTextField1------ txtAcer
JTextField2-------txtAxioo
JTextField3------- txtKompek
JTextField 4-------txtSamsung
Langsung aja nih gan scrip program nya…,…….
package latihan; // nama project yang digunakan
import javax.swing.JOptionPane;
public class fwarung extends javax.swing.JFrame
{
public fwarung() { //
nama jFrame From,,, mongo kalo mau di samakan…
initComponents();
rdgCaraBayar.add(rdoCash);
rdgCaraBayar.add(rdoBCACard);
rdgCaraBayar.add(rdoMandiri);
}
è
Isi
ActionPerformed Chek Box Acer…
private
void chkAcerActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
if (chkAcer.isSelected()){
txtAcer.setEditable(true);
txtAcer.setText("1");
}else {
txtAcer.setEditable(false);
txtAcer.setText("0");
}
}
è
Isi
ActionPerformed Chek Box Axioo…
private void
chkAxiooActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
if (chkAxioo.isSelected()){
txtAxioo.setEditable(true);
txtAxioo.setText("1");
}else {
txtAxioo.setEditable(false);
txtAxioo.setText("0");
}
}
è
Isi
ActionPerformed Chek Box Samsung…
private
void chkSamsungActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
if (chkSamsung.isSelected()){
txtSamsung.setEditable(true);
txtSamsung.setText("1");
}else {
txtSamsung.setEditable(false);
txtSamsung.setText("0");
}
}
è
Isi
ActionPerformed Chek Box Compek…
private void
chkCompekActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
if (chkCompek.isSelected()){
txtKompek.setEditable(true);
txtKompek.setText("1");
}else {
txtKompek.setEditable(false);
txtKompek.setText("0");
}
}
è
Isi
ActionPerformed Button Hitung…
private
void btnHitungActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
boolean lDataOke = true;
if (chkAcer.isSelected()&&
txtAcer.getText() == " ")
lDataOke = false;
if (chkAxioo.isSelected()&&
txtAxioo.getText() == " ")
lDataOke = false;
if (chkSamsung.isSelected()&&
txtSamsung.getText() == " ")
lDataOke = false;
if (chkCompek.isSelected()&&
txtKompek.getText() == " ")
lDataOke = false;
if (!lDataOke) {
JOptionPane.showMessageDialog(this,
"Data Dilengkapi Dahulu");
// Untuk Menampilkan validasi..
}else
{
int nAcer = Integer.parseInt (txtAcer.getText());
int nAxioo = Integer.parseInt (txtAxioo.getText());
int nSamsung = Integer.parseInt (txtSamsung.getText());
int nKompek = Integer.parseInt (txtKompek.getText());
//hitung Total
int nTotal = (5000000 *nAcer)+
(6000000 *
nAxioo)+(7000000 * nSamsung)+(6500000 * nKompek);
lblTotal.setText("Rp.
"+nTotal);
//bagian ini untuk menampilkan
cara bayar
if (rdoCash.isSelected())
lblCaraBayar.setText(rdoCash.getActionCommand());
if (rdoBCACard.isSelected())
lblCaraBayar.setText(rdoBCACard.getActionCommand());
if (rdoMandiri.isSelected())
lblCaraBayar.setText(rdoMandiri.getActionCommand());
}
}
è
Sript
Untuk Mengosongkan data yang sudah di pilih…
private
void btnKosongActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
chkAcer.setSelected(false);
chkAxioo.setSelected(false);
chkSamsung.setSelected(false);
chkCompek.setSelected(false);
txtAcer.setText("0");
txtAxioo.setText("0");
txtSamsung.setText("0");
txtKompek.setText("0");
txtAcer.setEditable(false);
txtAxioo.setEditable(false);
txtSamsung.setEditable(false);
txtKompek.setEditable(false);
lblTotal.setText("Rp. 0");
lblCaraBayar.setText("Uang
Cash");
}
Hasil RUNning programnya nihh…!!
Semoga
Bermanfaat…. AMIiN
sedot langsung projecnya nii.. http://www.4shared.com/rar/ZJz94xcr/k_leptop_2.html
0 komentar: