Tampilkan postingan dengan label Java. Tampilkan semua postingan
Tampilkan postingan dengan label Java. Tampilkan semua postingan

30 Mar 2014

Java Basic Netbeans : Membuat Aplikasi Penjual Mengunakan Gui Iframe

hay para Bomber`s sudah lama saya tidak update blog ini . karena kesibukan saya kuliah dan kerja hehehe :D . kali ini saya akan membahas sedikit Tentang tugas dari tempat saya kulauh . Tentang Pembuatan APlikasi java Iframe . di sini saya akan membuat aplikasi Penjualan Paket Komputer Dengan fasilitas Kupon discon. saya tidak akan panjang lebar menjelasakan Scrip dan funginya karena keterbataan waktu . tapi kalo ada yang ingin bertanya Bisa langsung ke Twitter saya di @olidfire .

1 Pertama buat Desain Iframe seperti ini .



 




















- Berikut code atau scripnya
/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 *
 * @author BomberCom
 */
public class daftarPaket extends javax.swing.JFrame {

    /**
     * Creates new form daftarPaket
     */
    public daftarPaket() {
        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")
    //                          
    private void initComponents() {

        grup = new javax.swing.ButtonGroup();
        jButton2 = new javax.swing.JButton();
        jLabel1 = new javax.swing.JLabel();
        jSeparator1 = new javax.swing.JSeparator();
        po = new javax.swing.JRadioButton();
        grup.add(po);
        of = new javax.swing.JRadioButton();
        grup.add(of);
        ga = new javax.swing.JRadioButton();
        grup.add(ga);
        de = new javax.swing.JRadioButton();
        grup.add(de);
        ed = new javax.swing.JRadioButton();
        grup.add(ed);
        jButton1 = new javax.swing.JButton();
        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();
        jLabel7 = new javax.swing.JLabel();
        jLabel8 = new javax.swing.JLabel();
        pr = new javax.swing.JTextField();
        mo = new javax.swing.JTextField();
        me = new javax.swing.JTextField();
        hd = new javax.swing.JTextField();
        ve = new javax.swing.JTextField();
        mr = new javax.swing.JTextField();
        km = new javax.swing.JTextField();
        jLabel9 = new javax.swing.JLabel();
        hg = new javax.swing.JTextField();
        jLabel10 = new javax.swing.JLabel();
        D = new javax.swing.JTextField();
        jLabel11 = new javax.swing.JLabel();
        T = new javax.swing.JTextField();
        dis = new javax.swing.JTextField();
        jLabel12 = new javax.swing.JLabel();
        dl = new javax.swing.JButton();
        st = new javax.swing.JLabel();
        jMenuBar1 = new javax.swing.JMenuBar();
        jMenu1 = new javax.swing.JMenu();
        jMenu2 = new javax.swing.JMenu();

        jButton2.setText("jButton2");

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

        jLabel1.setFont(new java.awt.Font("Virtual DJ", 1, 14)); // NOI18N
        jLabel1.setText("DAFTAR PAKET KOMPUTER");

        po.setText("Personal");
        po.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                poActionPerformed(evt);
            }
        });

        of.setText("Office");
        of.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                ofActionPerformed(evt);
            }
        });

        ga.setText("Gameing");
        ga.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                gaActionPerformed(evt);
            }
        });

        de.setText("Desain");
        de.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                deActionPerformed(evt);
            }
        });

        ed.setText("Editor Music / Video");
        ed.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                edActionPerformed(evt);
            }
        });

        jButton1.setText("CEK");
        jButton1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton1ActionPerformed(evt);
            }
        });

        jLabel2.setText("Prosessor");

        jLabel3.setText("Motherboard");

        jLabel4.setText("Memory");

        jLabel5.setText("Harddisk");

        jLabel6.setText("VGA");

        jLabel7.setText("Monitor");

        jLabel8.setText("Keyboard & Mouse");

        mo.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                moActionPerformed(evt);
            }
        });

        jLabel9.setText("HARGA");

        jLabel10.setText("KUPON DISCON");

        jLabel11.setText("TOTAL");

        jLabel12.setText("%");

        dl.setText("DEAL");
        dl.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                dlActionPerformed(evt);
            }
        });

        st.setText("status");

        jMenu1.setText("File");
        jMenuBar1.add(jMenu1);

        jMenu2.setText("Edit");
        jMenuBar1.add(jMenu2);

        setJMenuBar(jMenuBar1);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jSeparator1)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(de)
                    .addComponent(po)
                    .addComponent(of)
                    .addComponent(ga)
                    .addComponent(ed)
                    .addGroup(layout.createSequentialGroup()
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel2)
                            .addComponent(jLabel3)
                            .addComponent(jLabel4)
                            .addComponent(jLabel5)
                            .addComponent(jLabel6)
                            .addComponent(jLabel7)
                            .addComponent(jLabel8)
                            .addComponent(jLabel9)
                            .addComponent(jLabel10)
                            .addComponent(jLabel11))
                        .addGap(25, 25, 25)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                            .addComponent(mo)
                            .addComponent(me)
                            .addComponent(hd)
                            .addComponent(ve)
                            .addComponent(mr)
                            .addComponent(km)
                            .addComponent(pr)
                            .addComponent(hg)
                            .addComponent(D)
                            .addComponent(T, javax.swing.GroupLayout.PREFERRED_SIZE, 136, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                                .addComponent(st, javax.swing.GroupLayout.PREFERRED_SIZE, 36, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addGap(18, 18, 18)
                                .addComponent(dis, javax.swing.GroupLayout.PREFERRED_SIZE, 35, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(jLabel12)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                .addComponent(jButton1)
                                .addGap(68, 68, 68))
                            .addComponent(dl, javax.swing.GroupLayout.PREFERRED_SIZE, 70, javax.swing.GroupLayout.PREFERRED_SIZE)))
                    .addGroup(layout.createSequentialGroup()
                        .addGap(30, 30, 30)
                        .addComponent(jLabel1)))
                .addGap(0, 0, Short.MAX_VALUE))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 26, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(3, 3, 3)
                .addComponent(jSeparator1, javax.swing.GroupLayout.PREFERRED_SIZE, 10, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(po)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(of)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(ga)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(de)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(ed)
                .addGap(26, 26, 26)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel2)
                    .addComponent(pr, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel3)
                    .addComponent(mo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel4)
                    .addComponent(me, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel5)
                    .addComponent(hd, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel6)
                    .addComponent(ve, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel7)
                    .addComponent(mr, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel8)
                    .addComponent(km, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel9)
                    .addComponent(hg, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel10)
                    .addComponent(D, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(dis, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel12)
                    .addComponent(st)
                    .addComponent(jButton1))
                .addGap(2, 2, 2)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(T, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel11))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(dl, javax.swing.GroupLayout.DEFAULT_SIZE, 35, Short.MAX_VALUE))
        );

        pack();
    }//
                     
    /**
     * 
     * Awal Scrip 
     */
    private void poActionPerformed(java.awt.event.ActionEvent evt) {                                   
       if (po.isSelected());
            pr.setText("Pentium IV");
            mo.setText("Asus G31");
            me.setText("Kingston 2gb");
            hd.setText("80 GB");
            ve.setText("---");
            mr.setText("LCD 14inch ");
            km.setText("include");
            hg.setText("1500000");
            
            
    }                                  

    private void moActionPerformed(java.awt.event.ActionEvent evt) {                                   
        // TODO add your handling code here:
    }                                  

    private void ofActionPerformed(java.awt.event.ActionEvent evt) {                                   
        if (of.isSelected());
            pr.setText("Pentium IV");
            mo.setText("Asus G31");
            me.setText("Kingston 2gb");
            hd.setText("120 GB");
            ve.setText("---");
            mr.setText("LCD 14inch ");
            km.setText("include");
            hg.setText("1550000");
    }                                  

    private void gaActionPerformed(java.awt.event.ActionEvent evt) {                                   
       if (of.isSelected());
            pr.setText("intel i3");
            mo.setText("Asus H61");
            me.setText("Kingston 8gb");
            hd.setText("1 TB");
            ve.setText("Asus Pixma 2 GB ");
            mr.setText("LCD 21inch ");
            km.setText("include");
            hg.setText("4500000");
    }                                  

    private void deActionPerformed(java.awt.event.ActionEvent evt) {                                   
          if (de.isSelected());
            pr.setText("intel i5 4670");
            mo.setText("Gigabyte GA-Z87M-D3H");
            me.setText("Corsair 8gb");
            hd.setText("1 TB");
            ve.setText("Gigabyte GTX 660 2Gb ");
            mr.setText("LCD 21inch ");
            km.setText("include");
            hg.setText("8000000");
    }                                  

    private void edActionPerformed(java.awt.event.ActionEvent evt) {                                   
      if (ed.isSelected());
            pr.setText("intel i7 4670");
            mo.setText("Gigabyte GA-Z87M-D3H");
            me.setText("Corsair 16gb");
            hd.setText("2 TB");
            ve.setText("Gigabyte GTX 660 2Gb ");
            mr.setText("LCD 21inch ");
            km.setText("include");
            hg.setText("12000000");
    }                                  

    private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {                                         
      int res=Integer.parseInt(D.getText());
        
        if (res==32304) {
          st.setText("Valid");
          dis.setText("20");
        }else if (res==32305) {
           st.setText("Valid");
          dis.setText("30");
         }else if (res==32306) {
            st.setText("Valid");
          dis.setText("25");
          }else if (res==32302) {
            st.setText("Valid");
          dis.setText("10");
          }else  {
             st.setText("Invalid");
          dis.setText("0");{
        }
        }
    }                                        

    private void dlActionPerformed(java.awt.event.ActionEvent evt) {                                   
      int num1 = Integer.parseInt(hg.getText());
      int num2 = Integer.parseInt(dis.getText());
        int num3 = (num1*num2/100);
        int num4 = (num1-num3);
        T.setText(""+ num4);   
        
    }                                  

    /**
     * Akhir Scrip
     */
    public static void main(String args[]) {
        /* Set the Nimbus look and feel */
        //
        /* 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(daftarPaket.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(daftarPaket.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(daftarPaket.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(daftarPaket.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }
        //

        /* Create and display the form */
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new daftarPaket().setVisible(true);
            }
        });
    }
    // Variables declaration - do not modify                    
    private javax.swing.JTextField D;
    private javax.swing.JTextField T;
    private javax.swing.JRadioButton de;
    private javax.swing.JTextField dis;
    private javax.swing.JButton dl;
    private javax.swing.JRadioButton ed;
    private javax.swing.JRadioButton ga;
    private javax.swing.ButtonGroup grup;
    private javax.swing.JTextField hd;
    private javax.swing.JTextField hg;
    private javax.swing.JButton jButton1;
    private javax.swing.JButton jButton2;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel10;
    private javax.swing.JLabel jLabel11;
    private javax.swing.JLabel jLabel12;
    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.JLabel jLabel9;
    private javax.swing.JMenu jMenu1;
    private javax.swing.JMenu jMenu2;
    private javax.swing.JMenuBar jMenuBar1;
    private javax.swing.JSeparator jSeparator1;
    private javax.swing.JTextField km;
    private javax.swing.JTextField me;
    private javax.swing.JTextField mo;
    private javax.swing.JTextField mr;
    private javax.swing.JRadioButton of;
    private javax.swing.JRadioButton po;
    private javax.swing.JTextField pr;
    private javax.swing.JLabel st;
    private javax.swing.JTextField ve;
    // End of variables declaration                  
}


Code Kupon yang bisa di inputkan adalah 
- if (res==32304) {
          st.setText("Valid");
          dis.setText("20");
        }else if (res==32305) {
           st.setText("Valid");
          dis.setText("30");
         }else if (res==32306) {
            st.setText("Valid");
          dis.setText("25");
          }else if (res==32302) {
            st.setText("Valid");
          dis.setText("10");
          }else  {
             st.setText("Invalid");
          dis.setText("0");{
        }
        }
    }                                       
Scrip diatas untuk Code kupon
Read More

26 Jan 2014

JAVA BASIC NetBeans - Membuat Aplikasi GUI Iframe

Sudah lama tidak update blog kali ini saya akan sedikit memberikan Tutorial bagaimana membuat Aplikasi berbasis Java Denga Gui kali . sesuai Tugas Kuliah kali ini saya membahas Tentang aplikasi Penjual Mobil Basis Java GUI .

Berikut Sourchcode dan tampilanya

Buat tampilaan mengunakan Iframe seperti berikut menguanakn control Tool.















Setelah itu lakukan Tulis Scrip Berikut atau copy n paste

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package swing;

/**
 *
 * @author BomberCom
 */
public class PejualanMobil extends javax.swing.JFrame {

    /**
     * Creates new form PejualanMobil
     */
    public PejualanMobil() {
        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")
    //                          
    private void initComponents() {

        grup = new javax.swing.ButtonGroup();
        jLabel1 = new javax.swing.JLabel();
        av = new javax.swing.JRadioButton();
        grup.add(av);
        xe = new javax.swing.JRadioButton();
        grup.add(xe);
        er = new javax.swing.JRadioButton();
        f = new javax.swing.JRadioButton();
        jSeparator1 = new javax.swing.JSeparator();
        jSeparator2 = new javax.swing.JSeparator();
        jLabel2 = new javax.swing.JLabel();
        jm = new javax.swing.JTextField();
        jLabel3 = new javax.swing.JLabel();
        jLabel4 = new javax.swing.JLabel();
        hp = new javax.swing.JTextField();
        jLabel6 = new javax.swing.JLabel();
        t = new javax.swing.JTextField();
        jButton1 = new javax.swing.JButton();
        jSeparator3 = new javax.swing.JSeparator();
        cpph = new javax.swing.JCheckBox();
        pph = new javax.swing.JTextField();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

        jLabel1.setText("APLIKASI PENJUALAN MOBIL");

        av.setText("Avanza");
        av.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                avActionPerformed(evt);
            }
        });

        xe.setText("Xenia");
        xe.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                xeActionPerformed(evt);
            }
        });

        er.setText("Ertiga");
        grup.add(er);
        er.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                erActionPerformed(evt);
            }
        });

        f.setText("Fourtuner");
        grup.add(f);
        f.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                fActionPerformed(evt);
            }
        });

        jLabel2.setText("BOMBERCOMPUTER 2014");

        jLabel3.setText("Jumlah Mobil Terjual");

        jLabel4.setText("Harga Perunit ($)");

        hp.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                hpActionPerformed(evt);
            }
        });

        jLabel6.setText("Total Penjualan :");

        jButton1.setText("HITUNG");
        jButton1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton1ActionPerformed(evt);
            }
        });

        cpph.setText("Total  PPH 10%");
        cpph.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                cpphActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jSeparator1)
            .addComponent(jSeparator2)
            .addGroup(layout.createSequentialGroup()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addGap(140, 140, 140)
                        .addComponent(jLabel1))
                    .addGroup(layout.createSequentialGroup()
                        .addGap(155, 155, 155)
                        .addComponent(jLabel2)))
                .addGap(0, 0, Short.MAX_VALUE))
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(av)
                    .addComponent(er)
                    .addComponent(xe)
                    .addComponent(f))
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addGap(160, 160, 160)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(hp, javax.swing.GroupLayout.PREFERRED_SIZE, 182, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jButton1)
                            .addComponent(jLabel3)
                            .addComponent(jLabel4)
                            .addComponent(jm, javax.swing.GroupLayout.PREFERRED_SIZE, 45, javax.swing.GroupLayout.PREFERRED_SIZE)))
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(cpph)
                            .addComponent(pph, javax.swing.GroupLayout.PREFERRED_SIZE, 154, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(t, javax.swing.GroupLayout.PREFERRED_SIZE, 182, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel6, javax.swing.GroupLayout.PREFERRED_SIZE, 108, javax.swing.GroupLayout.PREFERRED_SIZE))))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addComponent(jSeparator3, javax.swing.GroupLayout.DEFAULT_SIZE, 1, Short.MAX_VALUE))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 14, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jSeparator1, javax.swing.GroupLayout.PREFERRED_SIZE, 10, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(av)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(xe)
                        .addGap(25, 25, 25)
                        .addComponent(er)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(f)
                        .addGap(4, 4, 4)
                        .addComponent(jSeparator3, javax.swing.GroupLayout.PREFERRED_SIZE, 4, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(layout.createSequentialGroup()
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(layout.createSequentialGroup()
                                .addGap(18, 18, 18)
                                .addComponent(jm, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                .addComponent(jLabel4))
                            .addComponent(jLabel3, javax.swing.GroupLayout.PREFERRED_SIZE, 14, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(6, 6, 6)
                        .addComponent(hp, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jButton1)
                        .addGap(8, 8, 8)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel6)
                            .addComponent(cpph))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(t, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(pph, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addComponent(jSeparator2, javax.swing.GroupLayout.PREFERRED_SIZE, 10, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jLabel2)
                .addContainerGap())
        );

        pack();
    }//
                       
    private void hpActionPerformed(java.awt.event.ActionEvent evt) {                                   
        // TODO add your handling code here:
    }                                  

    private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {                                         
        // TODO add your handling code here:
        int bil1 = Integer.parseInt(jm.getText());
        int bil2 = Integer.parseInt(hp.getText());
        int bil3 =  bil1 *bil2;
        t  .setText(""+ bil3);
        
       
        
    }                                        

    private void erActionPerformed(java.awt.event.ActionEvent evt) {                                   
        // TODO add your handling code here:
        if (er.isSelected());
            hp.setText("100000");
    }                                  

    private void avActionPerformed(java.awt.event.ActionEvent evt) {                                   
        // TODO add your handling code here:
        if (av.isSelected());
            hp.setText("150000");

        
    }                                  

    private void xeActionPerformed(java.awt.event.ActionEvent evt) {                                   
        // TODO add your handling code here:
        if (xe.isSelected());
            hp.setText("125000");
    }                                  

    private void fActionPerformed(java.awt.event.ActionEvent evt) {                                  
        // TODO add your handling code here:
        if (f.isSelected());
            hp.setText("6500000");
    }                                 

    private void cpphActionPerformed(java.awt.event.ActionEvent evt) {                                     
        // TODO add your handling code here:
        int bph1 = Integer.parseInt(t.getText());
        
        if (cpph.isSelected());
        int bph2 =  bph1 * 10 /100;
        pph.setText(""+ bph2);
        
    }                                    

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        /* Set the Nimbus look and feel */
        //
        /* 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(PejualanMobil.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(PejualanMobil.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(PejualanMobil.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(PejualanMobil.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }
        //

        /* Create and display the form */
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new PejualanMobil().setVisible(true);
            }
        });
    }
    // Variables declaration - do not modify                     
    private javax.swing.JRadioButton av;
    private javax.swing.JCheckBox cpph;
    private javax.swing.JRadioButton er;
    private javax.swing.JRadioButton f;
    private javax.swing.ButtonGroup grup;
    private javax.swing.JTextField hp;
    private javax.swing.JButton jButton1;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JSeparator jSeparator1;
    private javax.swing.JSeparator jSeparator2;
    private javax.swing.JSeparator jSeparator3;
    private javax.swing.JTextField jm;
    private javax.swing.JTextField pph;
    private javax.swing.JTextField t;
    private javax.swing.JRadioButton xe;
    // End of variables declaration                   
}

Setlah itu lagukan Pengetestaan dengan menRun hasilnya 

















Jika berhasil akan tampil seperti di atas terimakasih telah membaca masih banyak lagi artikel seputra dunia IT di blog ini terimakasih
Read More

7 Des 2013

JAVA BASIC NetBeans : Java Class dan Objek Sederhana

Berhubung ada tugas dari dosen ane kali ini ane mau posting sedikit Scrip java Class mengunakan aplikasi Netbeans . aplikasi ini sih sederhan banget mungkin kalo yang udh mahir bisa di sambungkan dengan posting ane sebelumnya tentang JAVA BASIC NetBeans : MEMBUAT APLIKASI PERKALIAN SEDERHANA DENGAN UTILITI SCANNER Dengan utilti scanner ..

Pertama buat lah File Java dengan Nama Mobil.java pada Netbeans ; lalu Copy paste code berikut

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 *
 * @author BomberCom
 */
public final class Mobil {
    private String nama;
    private int kapasitasBBM;
    private int kapasitasPenumpang;
    private String warna;
    
    public Mobil() {
    }
    
    /**
     *
     * @param _nama
     * @param _bbm
     * @param _penumpang
     * @param _warna
     */
    public Mobil(String _nama, int _bbm, int _penumpang, String _warna)
    {
        setNama(_nama);
        setKapasitasBBM(_bbm);
        setKapasitasPenumpang(_penumpang);
        setWarna(_warna);
    }

    public void setNama(String nama) {
        this.nama = nama;
    }

    public void setKapasitasBBM(int kapasitasBBM) {
        this.kapasitasBBM = kapasitasBBM;
    }

    public void setKapasitasPenumpang(int kapasitasPenumpang) {
        this.kapasitasPenumpang = kapasitasPenumpang;
    }

    public void setWarna(String warna) {
        this.warna = warna;
    }

    public String getNama() {
        return nama;
    }

    public int getKapasitasBBM() {
        return kapasitasBBM;
    }

    public int getKapasitasPenumpang() {
        return kapasitasPenumpang;
    }

    public String getWarna() {
        return warna;
    }
    
    public void cetakInfor()
    {
        System.out.println("Nama Mobil :"+getNama());
        System.out.println("Kapasitas BBM :"+getKapasitasBBM());
        System.out.println("Kapasitas Penumpang :"+getKapasitasPenumpang());
        System.out.println("Warna :"+getWarna());
        System.out.println("");
    }
}

setelah selsai di copy selanjutnya buat file java kembali dengan packets yang sama ... dengan nama file Main.java

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 *
 * @author BomberCom
 */
public class Main {
    /** Creates a new instance of Main */
    public Main() {
    }
    
    public static void main(String[] args)
    {
        Mobil m = new Mobil("Kijang",250,8,"Merah");
        Mobil n = new Mobil("Panter",250,10,"Biru");
        m.cetakInfor();
        n.cetakInfor();
    }
}

Jika sudah silakan di run setelah itu akan muncul tampilan seperti di bawah ini


Selsai sudah aplikasi simple dengan Class dan Objek . terimakasih 



Read More

30 Sep 2013

JAVA BASIC NetBeans : MEMBUAT APLIKASI PERKALIAN SEDERHANA DENGAN UTILITI SCANNER

Sudah lama tidak update blog ini . mumpung ada tugas neh dari dosen buat bikin aplikasi dengan JAVA UTILITI SCANNER untuk menginput data dari keyboard . nah kali ini saya akan menginplementasikanya melalui Program perkalian sederhana .

Aplikasi yang saya gunakan untuk membuat Program ini adalah NetBeans IDE 7.3.1 dan JAVA DEVELOPMENT KIT .

STRUKTUR ALGORITMANYA BAHASA INDONESIANYA

 -  MULAI
 -  INPUT NILAI PERTAMA
 -  INPUT NILAI KEDUA
 -  PROSES ( NILAI PERTAMA x NILAI KEDUA )
 -  CETAK HASIL
 -  SELESAI

FlOW CHART





















DEKLARASI

- NILAI PERTAMA  DEKLARASI N1
- NILAI KEDUA       DEKLARASI N2
- HASIL                     DEKLARASI HL
- PROSES                  DEKLARASI N1*N2

SOURCE CODE

import java.util.Scanner;
/* IMPORT UTILITI SCANNER PADA APLIKASI JAVA
/**
*
* @author Bombercomputer
*/
public class perkalian {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
// INPUT CODE DI BAWAH SINI

Scanner masuk=new Scanner(System.in);
System.out.print("NILAI PERTAMA:");
int N1= masuk.nextInt();

System.out.print("NILAI KEDUA:");
int N2= masuk.nextInt();

int hasil=N1*N2;
System.out.print ("hasil total=" +hasil);
     }

}


 ketika di RUN akan seperti video di bawah ini