Kamis, 29 Desember 2016
Aplikasi Penjualan Handphone menggunakan Java Netbeans
Hasil Run :
Screen Shoot Source Coding :
Screen Shoot Source Coding :
Source Coding :
Source Coding yang harus dibuat untuk membuat aplikasi ini adalah :
/*
* 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.
*/
/**
*
* @author Asus
*/
public class apps extends javax.swing.JFrame {
/**
* Creates new form apps
*/
public apps() {
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() {
jLabel6 = new javax.swing.JLabel();
bg = new javax.swing.ButtonGroup();
jColorChooser1 = new javax.swing.JColorChooser();
jInternalFrame1 = new javax.swing.JInternalFrame();
CheckBox4 = new javax.swing.JCheckBox();
vselesai = new javax.swing.JButton();
vmulai = new javax.swing.JButton();
vharga = new javax.swing.JLabel();
txt1 = new javax.swing.JTextField();
b = new javax.swing.JComboBox();
ds2 = new javax.swing.JRadioButton();
bg.add(ds2);
ds4 = new javax.swing.JRadioButton();
bg.add(ds4);
ds1 = new javax.swing.JRadioButton();
bg.add(ds1);
ds3 = new javax.swing.JRadioButton();
bg.add(ds3);
jLabel10 = new javax.swing.JLabel();
CheckBox1 = new javax.swing.JCheckBox();
jLabel1 = new javax.swing.JLabel();
vtotal = new javax.swing.JLabel();
vdiskon = new javax.swing.JLabel();
vtype = new javax.swing.JLabel();
txt2 = new javax.swing.JTextField();
txt4 = new javax.swing.JTextField();
CheckBox3 = new javax.swing.JCheckBox();
CheckBox2 = new javax.swing.JCheckBox();
jLabel11 = new javax.swing.JLabel();
txt3 = new javax.swing.JTextField();
jLabel2 = new javax.swing.JLabel();
jLabel3 = new javax.swing.JLabel();
jLabel4 = new javax.swing.JLabel();
jLabel5 = new javax.swing.JLabel();
jLabel6.setText("Diskon");
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
setBackground(new java.awt.Color(255, 135, 122));
addWindowListener(new java.awt.event.WindowAdapter() {
public void windowActivated(java.awt.event.WindowEvent evt) {
formWindowActivated(evt);
}
});
jInternalFrame1.setBackground(new java.awt.Color(255, 153, 255));
jInternalFrame1.setVisible(true);
CheckBox4.setText("Memory External");
vselesai.setText("Selesai");
vselesai.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
vselesaiActionPerformed(evt);
}
});
vmulai.setText("Mulai");
vmulai.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
vmulaiActionPerformed(evt);
}
});
vharga.setText("Harga");
txt1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
txt1ActionPerformed(evt);
}
});
b.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
bActionPerformed(evt);
}
});
ds2.setText("30%");
ds2.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
ds2ActionPerformed(evt);
}
});
ds4.setText("50%");
ds4.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
ds4ActionPerformed(evt);
}
});
ds1.setText("20%");
ds1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
ds1ActionPerformed(evt);
}
});
ds3.setText("40%");
ds3.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
ds3ActionPerformed(evt);
}
});
jLabel10.setText("Bonus");
CheckBox1.setText("Charger");
jLabel1.setFont(new java.awt.Font("Curlz MT", 3, 24)); // NOI18N
jLabel1.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
jLabel1.setText("Aplikasi Penjualan Handphone");
jLabel1.setBorder(javax.swing.BorderFactory.createMatteBorder(5, 5, 5, 5, new java.awt.Color(255, 51, 102)));
jLabel1.setIconTextGap(5);
vtotal.setText("Total Harga");
vdiskon.setText("Diskon");
vtype.setText("Brand");
txt2.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
txt2ActionPerformed(evt);
}
});
CheckBox3.setText("Flip Cover");
CheckBox2.setText("HeadSet");
jLabel11.setText("Diskon");
txt3.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
txt3ActionPerformed(evt);
}
});
jLabel2.setText("%");
jLabel3.setText("Rp");
jLabel4.setText("Rp");
jLabel5.setText("Rp");
javax.swing.GroupLayout jInternalFrame1Layout = new javax.swing.GroupLayout(jInternalFrame1.getContentPane());
jInternalFrame1.getContentPane().setLayout(jInternalFrame1Layout);
jInternalFrame1Layout.setHorizontalGroup(
jInternalFrame1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jInternalFrame1Layout.createSequentialGroup()
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(vmulai, javax.swing.GroupLayout.PREFERRED_SIZE, 101, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(81, 81, 81)
.addComponent(vselesai, javax.swing.GroupLayout.PREFERRED_SIZE, 101, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(174, 174, 174))
.addGroup(jInternalFrame1Layout.createSequentialGroup()
.addGap(33, 33, 33)
.addGroup(jInternalFrame1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addGroup(jInternalFrame1Layout.createSequentialGroup()
.addGroup(jInternalFrame1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addGroup(jInternalFrame1Layout.createSequentialGroup()
.addGroup(jInternalFrame1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(vtype, javax.swing.GroupLayout.PREFERRED_SIZE, 134, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(vtotal, javax.swing.GroupLayout.PREFERRED_SIZE, 134, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(vdiskon, javax.swing.GroupLayout.PREFERRED_SIZE, 134, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGroup(jInternalFrame1Layout.createSequentialGroup()
.addComponent(vharga, javax.swing.GroupLayout.PREFERRED_SIZE, 134, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jLabel4)))
.addGap(9, 9, 9))
.addGroup(jInternalFrame1Layout.createSequentialGroup()
.addGroup(jInternalFrame1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(jLabel5)
.addComponent(jLabel3))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)))
.addGroup(jInternalFrame1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addGroup(jInternalFrame1Layout.createSequentialGroup()
.addGroup(jInternalFrame1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(ds1, javax.swing.GroupLayout.Alignment.TRAILING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jInternalFrame1Layout.createSequentialGroup()
.addComponent(txt1, javax.swing.GroupLayout.PREFERRED_SIZE, 146, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(ds2))
.addComponent(txt4, javax.swing.GroupLayout.PREFERRED_SIZE, 146, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGroup(jInternalFrame1Layout.createSequentialGroup()
.addGroup(jInternalFrame1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(txt3, javax.swing.GroupLayout.PREFERRED_SIZE, 146, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGroup(jInternalFrame1Layout.createSequentialGroup()
.addComponent(txt2, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(jLabel2)))
.addGap(55, 55, 55)
.addGroup(jInternalFrame1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(ds4)
.addComponent(ds3, javax.swing.GroupLayout.Alignment.TRAILING))))
.addGap(50, 50, 50))
.addGroup(jInternalFrame1Layout.createSequentialGroup()
.addComponent(b, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jLabel11, javax.swing.GroupLayout.PREFERRED_SIZE, 83, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(14, 14, 14))))
.addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 333, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(18, 18, 18)
.addGroup(jInternalFrame1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(CheckBox4)
.addComponent(CheckBox3)
.addComponent(CheckBox2)
.addComponent(CheckBox1)
.addComponent(jLabel10, javax.swing.GroupLayout.PREFERRED_SIZE, 127, javax.swing.GroupLayout.PREFERRED_SIZE))
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
jInternalFrame1Layout.setVerticalGroup(
jInternalFrame1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jInternalFrame1Layout.createSequentialGroup()
.addGap(27, 27, 27)
.addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 50, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(87, 87, 87)
.addGroup(jInternalFrame1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel10, javax.swing.GroupLayout.PREFERRED_SIZE, 26, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(vtype, javax.swing.GroupLayout.PREFERRED_SIZE, 24, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel11, javax.swing.GroupLayout.PREFERRED_SIZE, 26, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(b, javax.swing.GroupLayout.PREFERRED_SIZE, 28, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(14, 14, 14)
.addGroup(jInternalFrame1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(ds1, javax.swing.GroupLayout.PREFERRED_SIZE, 26, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(CheckBox1, javax.swing.GroupLayout.PREFERRED_SIZE, 26, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(jInternalFrame1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(ds2, javax.swing.GroupLayout.PREFERRED_SIZE, 26, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(CheckBox2, javax.swing.GroupLayout.PREFERRED_SIZE, 26, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(vharga, javax.swing.GroupLayout.PREFERRED_SIZE, 26, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(txt1, javax.swing.GroupLayout.PREFERRED_SIZE, 26, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel4))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(jInternalFrame1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(vdiskon, javax.swing.GroupLayout.PREFERRED_SIZE, 26, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(txt2, javax.swing.GroupLayout.PREFERRED_SIZE, 26, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(ds3, javax.swing.GroupLayout.PREFERRED_SIZE, 26, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(CheckBox3, javax.swing.GroupLayout.PREFERRED_SIZE, 26, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel2))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(jInternalFrame1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(ds4, javax.swing.GroupLayout.PREFERRED_SIZE, 26, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(CheckBox4, javax.swing.GroupLayout.PREFERRED_SIZE, 26, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(txt3, javax.swing.GroupLayout.PREFERRED_SIZE, 26, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel3))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(jInternalFrame1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(vtotal, javax.swing.GroupLayout.PREFERRED_SIZE, 26, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(txt4, javax.swing.GroupLayout.PREFERRED_SIZE, 26, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel5))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 96, Short.MAX_VALUE)
.addGroup(jInternalFrame1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(vselesai, javax.swing.GroupLayout.PREFERRED_SIZE, 32, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(vmulai, javax.swing.GroupLayout.PREFERRED_SIZE, 32, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(30, 30, 30))
);
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jInternalFrame1)
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addComponent(jInternalFrame1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(0, 0, Short.MAX_VALUE))
);
pack();
}// </editor-fold>
Source Coding di"ComboBox"
private void bActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
if(b.getSelectedItem()=="Pilih"){
txt1.setText("");
}else if(b.getSelectedItem()=="Samsung Galaxy Grand"){
txt1.setText("3000000");
}else if(b.getSelectedItem()=="Samsung Galaxy Grand2"){
txt1.setText("4500000");
}else if(b.getSelectedItem()=="Samsung Champ"){
txt1.setText("650000");
}else if(b.getSelectedItem()=="Samsung Champ Duos"){
txt1.setText("800000");
}else{
txt1.setText("1200000");
}
}
Source Coding di Button "Selesai"
private void vselesaiActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
System.exit(0);
}
// TODO add your handling code here:
System.exit(0);
}
Source Coding di Button "Mulai"
private void vmulaiActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
txt1.setText("");
txt2.setText("");
txt3.setText("");
txt4.setText("");
}
Source Coding dikolom RadioButton "20%"
private void ds1ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
if(ds1.isSelected());
txt2.setText("20");
}
private void ds1ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
if(ds1.isSelected());
txt2.setText("20");
}
Source Coding dikolom RadioButton "30%"
private void ds2ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
if(ds2.isSelected());
txt2.setText("30");
}
private void ds2ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
if(ds2.isSelected());
txt2.setText("30");
}
Source Coding dikolom RadioButton "40%"
private void ds3ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
if(ds3.isSelected());
txt2.setText("30");
}
private void ds3ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
if(ds3.isSelected());
txt2.setText("30");
}
Source Coding dikolom RadioButton "50%"
private void ds4ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
if(ds4.isSelected());
txt2.setText("50");
}
private void ds4ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
if(ds4.isSelected());
txt2.setText("50");
}
Source Coding dikolom diskon"Rp"
private void txt3ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
int a=Integer.parseInt(txt1.getText());
int b=Integer.parseInt(txt3.getText());
int hasil=a-b;
txt4.setText(""+hasil);
}
Source Coding dikolom diskon"%"
private void txt2ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
int x=Integer.parseInt(txt1.getText());
int y=Integer.parseInt(txt2.getText());
int hasil=(x*y)/100;
txt3.setText(""+hasil);
}
Sorce Coding di"ComboBox"
private void formWindowActivated(java.awt.event.WindowEvent evt) {
// TODO add your handling code here:
b.addItem("Pilih");
b.addItem("Samsung Galaxy Grand");
b.addItem("Samsung Galaxy Grand2");
b.addItem("Samsung Champ");
b.addItem("Samsung Champ Duos");
b.addItem("Samsung Galaxy Star");
}
private void txt1ActionPerformed(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(apps.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(apps.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(apps.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(apps.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
}
//</editor-fold>
//</editor-fold>
/* Create and display the form */
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new apps().setVisible(true);
}
});
}
// Variables declaration - do not modify
private javax.swing.JCheckBox CheckBox1;
private javax.swing.JCheckBox CheckBox2;
private javax.swing.JCheckBox CheckBox3;
private javax.swing.JCheckBox CheckBox4;
private javax.swing.JComboBox b;
private javax.swing.ButtonGroup bg;
private javax.swing.JRadioButton ds1;
private javax.swing.JRadioButton ds2;
private javax.swing.JRadioButton ds3;
private javax.swing.JRadioButton ds4;
private javax.swing.JColorChooser jColorChooser1;
private javax.swing.JInternalFrame jInternalFrame1;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel10;
private javax.swing.JLabel jLabel11;
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.JTextField txt1;
private javax.swing.JTextField txt2;
private javax.swing.JTextField txt3;
private javax.swing.JTextField txt4;
private javax.swing.JLabel vdiskon;
private javax.swing.JLabel vharga;
private javax.swing.JButton vmulai;
private javax.swing.JButton vselesai;
private javax.swing.JLabel vtotal;
private javax.swing.JLabel vtype;
// End of variables declaration
}
;;
Subscribe to:
Postingan (Atom)