Sabtu, 20 Mei 2017

PROGRAM PENDATAAN

PROGRAM PENDATAAN


Program ini bertujuan untuk melakukan sebuah pendataan dari ststus/jenjang pendidikan hingga pendapatannya lalu di gabung dengan beberapa tombol perintah bantuan yang bertujuan untuk memastikan apakah data yang di input sudah benar atau belum sesuai.




Source Code


import javax.swing.JOptionPane;

/*
 * 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 Fikri Darmansyah
 */
public class Pendidikan extends javax.swing.JFrame {

    /**
     * Creates new form Pendidikan
     */
    public Pendidikan() {
        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() {

        buttonGroup1 = new javax.swing.ButtonGroup();
        jLabel1 = new javax.swing.JLabel();
        TxtPendidikan = new javax.swing.JTextField();
        RBSD = new javax.swing.JRadioButton();
        buttonGroup1.add(RBSD);
        RBSMP = new javax.swing.JRadioButton();
        buttonGroup1.add(RBSMP);
        RBSMA = new javax.swing.JRadioButton();
        buttonGroup1.add(RBSMA);
        RBD3 = new javax.swing.JRadioButton();
        buttonGroup1.add(RBD3);
        CBTunjangan = new javax.swing.JCheckBox();
        Gajipokok = new javax.swing.JLabel();
        TxtGaji = new javax.swing.JTextField();
        TxtTunjangan = new javax.swing.JTextField();
        TxtHelp = new javax.swing.JButton();
        TxtHelp1 = new javax.swing.JButton();
        TxtHelp2 = new javax.swing.JButton();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

        jLabel1.setText("PENDIDIKAN");

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

        RBSD.setText("SD");
        RBSD.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                RBSDActionPerformed(evt);
            }
        });

        RBSMP.setText("SMP");
        RBSMP.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                RBSMPActionPerformed(evt);
            }
        });

        RBSMA.setText("SMA");
        RBSMA.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                RBSMAActionPerformed(evt);
            }
        });

        RBD3.setText("D3");
        RBD3.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                RBD3ActionPerformed(evt);
            }
        });

        CBTunjangan.setText("Tunjangan 10%");
        CBTunjangan.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                CBTunjanganActionPerformed(evt);
            }
        });

        Gajipokok.setText("Gaji Pokok");

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

        TxtHelp.setText("HELP");
        TxtHelp.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                TxtHelpActionPerformed(evt);
            }
        });

        TxtHelp1.setText("QUIT");
        TxtHelp1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                TxtHelp1ActionPerformed(evt);
            }
        });

        TxtHelp2.setText("INPUT");
        TxtHelp2.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                TxtHelp2ActionPerformed(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, false)
                    .addGroup(layout.createSequentialGroup()
                        .addGap(26, 26, 26)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(layout.createSequentialGroup()
                                .addComponent(RBSD)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(RBSMP))
                            .addComponent(jLabel1)
                            .addComponent(Gajipokok))
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(layout.createSequentialGroup()
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addGroup(layout.createSequentialGroup()
                                        .addComponent(RBSMA)
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                        .addComponent(RBD3))
                                    .addComponent(TxtPendidikan, javax.swing.GroupLayout.PREFERRED_SIZE, 103, javax.swing.GroupLayout.PREFERRED_SIZE)))
                            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                .addComponent(TxtGaji, javax.swing.GroupLayout.PREFERRED_SIZE, 98, javax.swing.GroupLayout.PREFERRED_SIZE))))
                    .addGroup(layout.createSequentialGroup()
                        .addGap(17, 17, 17)
                        .addComponent(CBTunjangan)
                        .addGap(18, 18, 18)
                        .addComponent(TxtTunjangan, javax.swing.GroupLayout.PREFERRED_SIZE, 98, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 58, Short.MAX_VALUE)
                .addComponent(TxtHelp)
                .addGap(49, 49, 49))
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                .addGap(0, 0, Short.MAX_VALUE)
                .addComponent(TxtHelp2)
                .addGap(99, 99, 99)
                .addComponent(TxtHelp1)
                .addGap(72, 72, 72))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addContainerGap()
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel1)
                            .addComponent(TxtPendidikan, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                    .addGroup(layout.createSequentialGroup()
                        .addGap(20, 20, 20)
                        .addComponent(TxtHelp)))
                .addGap(21, 21, 21)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(RBSD)
                    .addComponent(RBSMP)
                    .addComponent(RBSMA)
                    .addComponent(RBD3))
                .addGap(23, 23, 23)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(Gajipokok)
                    .addComponent(TxtGaji, 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(CBTunjangan)
                    .addComponent(TxtTunjangan, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 50, Short.MAX_VALUE)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(TxtHelp1)
                    .addComponent(TxtHelp2))
                .addGap(64, 64, 64))
        );

        pack();
    }// </editor-fold>                       

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

    private void RBSDActionPerformed(java.awt.event.ActionEvent evt) {                                    
        // TODO add your handling code here:
        TxtPendidikan.setText(RBSD.getText());
    }                                   

    private void RBSMPActionPerformed(java.awt.event.ActionEvent evt) {                                     
        // TODO add your handling code here:
        TxtPendidikan.setText(RBSMP.getText());
    }                                    

    private void RBSMAActionPerformed(java.awt.event.ActionEvent evt) {                                     
        // TODO add your handling code here:
        TxtPendidikan.setText(RBSMA.getText());
    }                                    

    private void RBD3ActionPerformed(java.awt.event.ActionEvent evt) {                                    
        // TODO add your handling code here:
        TxtPendidikan.setText(RBD3.getText());
    }                                   

    private void CBTunjanganActionPerformed(java.awt.event.ActionEvent evt) {                                           
        // TODO add your handling code here:
        if(CBTunjangan.isSelected()) {
        int Gajipokok=Integer.parseInt(TxtGaji.getText());
        int Tunjangan=Gajipokok/10;
        TxtTunjangan.setText(""+Tunjangan);

        }else{
TxtTunjangan.setText(""+TxtGaji.getText());
    }                                          

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

    private void TxtHelpActionPerformed(java.awt.event.ActionEvent evt) {                                       
        // TODO add your handling code here:
        JOptionPane.showMessageDialog(null,"Aplikasi Gaji release 2 developt By Eresha","Informasi",JOptionPane.INFORMATION_MESSAGE);

    }                                      

    private void TxtHelp1ActionPerformed(java.awt.event.ActionEvent evt) {                                        
        // TODO add your handling code here:
        int pilih=JOptionPane.showConfirmDialog(null, "Akan Selesai..?","Konfirmasi",JOptionPane.YES_NO_OPTION,JOptionPane.QUESTION_MESSAGE);
if(pilih==JOptionPane.YES_OPTION){
dispose();
}
    }                                       

    private void TxtHelp2ActionPerformed(java.awt.event.ActionEvent evt) {                                        
        // TODO add your handling code here:
        JOptionPane.showMessageDialog(null,"Apakah Data Benar..?","Input",JOptionPane.INFORMATION_MESSAGE);
    }                                       

    /**
     * @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(Pendidikan.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(Pendidikan.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(Pendidikan.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(Pendidikan.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 Pendidikan().setVisible(true);
            }
        });
    }

    // Variables declaration - do not modify                    
    private javax.swing.JCheckBox CBTunjangan;
    private javax.swing.JLabel Gajipokok;
    private javax.swing.JRadioButton RBD3;
    private javax.swing.JRadioButton RBSD;
    private javax.swing.JRadioButton RBSMA;
    private javax.swing.JRadioButton RBSMP;
    private javax.swing.JTextField TxtGaji;
    private javax.swing.JButton TxtHelp;
    private javax.swing.JButton TxtHelp1;
    private javax.swing.JButton TxtHelp2;
    private javax.swing.JTextField TxtPendidikan;
    private javax.swing.JTextField TxtTunjangan;
    private javax.swing.ButtonGroup buttonGroup1;
    private javax.swing.JLabel jLabel1;
    // End of variables declaration                  
}




DI JALANKAN DI JAVA


Kamis, 11 Mei 2017

Membuat Program List Mahasiswa



PROGRAM LIST MAHASISWA

Penjelasan Program
Program ini saya buat bertujuan untuk memudahkan pencarian mengenai Data Mahasiswa yang berkaitan dengan Nama, NIM, IPK, Angkatan, Jurusan, Grade dan tambahan menu lainnya.



 Data SourceCodding

/*
 * 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 listmahasiswa;

import java.util.ArrayList;

/**
 *
 * @author Fikri Darmansyah
 */
public class FormMahasiswa extends javax.swing.JFrame {
 ArrayList<Mahasiswa> daftar = new ArrayList<>();
    /**
     * Creates new form FormMahasiswa
     */
    public FormMahasiswa() {
        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();
        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();
        txtNIM = new javax.swing.JTextField();
        txtNAMA = new javax.swing.JTextField();
        txtIPK = new javax.swing.JTextField();
        bANGKATAN = new javax.swing.JLabel();
        lblJURUSAN = new javax.swing.JLabel();
        lblGRADE = new javax.swing.JLabel();
        btnKALKULASI = new javax.swing.JButton();
        btnSIMPAN = new javax.swing.JButton();
        btnRESET = new javax.swing.JButton();
        btnEXIT = new javax.swing.JButton();
        jLabel8 = new javax.swing.JLabel();
        jLabel9 = new javax.swing.JLabel();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));

        jLabel1.setFont(new java.awt.Font("Tw Cen MT Condensed Extra Bold", 1, 24)); // NOI18N
        jLabel1.setText("List Mahasiswa");
        jLabel1.setBorder(new javax.swing.border.MatteBorder(null));

        jLabel2.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
        jLabel2.setText("NIM");

        jLabel3.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
        jLabel3.setText("NAMA");

        jLabel4.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
        jLabel4.setText("IPK");

        jLabel5.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
        jLabel5.setText("ANGKATAN");

        jLabel6.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
        jLabel6.setText("JURUSAN");

        jLabel7.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
        jLabel7.setText("GRADE");

        bANGKATAN.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
        bANGKATAN.setText("Tahun");

        lblJURUSAN.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
        lblJURUSAN.setText("SI, TI, MI");

        lblGRADE.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
        lblGRADE.setText("A,  B,  C,  D");

        btnKALKULASI.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
        btnKALKULASI.setText("KALKULASI");
        btnKALKULASI.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnKALKULASIActionPerformed(evt);
            }
        });

        btnSIMPAN.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
        btnSIMPAN.setText("SIMPAN");
        btnSIMPAN.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnSIMPANActionPerformed(evt);
            }
        });

        btnRESET.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
        btnRESET.setText("RESET");
        btnRESET.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnRESETActionPerformed(evt);
            }
        });

        btnEXIT.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
        btnEXIT.setText("EXIT");
        btnEXIT.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnEXITActionPerformed(evt);
            }
        });

        jLabel8.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
        jLabel8.setText("Total Simpan");

        jLabel9.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
        jLabel9.setText("0");

        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(193, 193, 193)
                        .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 180, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(layout.createSequentialGroup()
                        .addContainerGap()
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel2)
                            .addComponent(jLabel3)
                            .addComponent(jLabel4)
                            .addComponent(jLabel5)
                            .addComponent(jLabel6)
                            .addComponent(jLabel7))
                        .addGap(66, 66, 66)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(layout.createSequentialGroup()
                                .addComponent(btnKALKULASI)
                                .addGap(18, 18, 18)
                                .addComponent(btnSIMPAN)
                                .addGap(18, 18, 18)
                                .addComponent(btnRESET))
                            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                                .addComponent(txtNIM, javax.swing.GroupLayout.DEFAULT_SIZE, 183, Short.MAX_VALUE)
                                .addComponent(txtNAMA)
                                .addComponent(txtIPK)
                                .addComponent(bANGKATAN, javax.swing.GroupLayout.PREFERRED_SIZE, 66, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addComponent(lblJURUSAN, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                .addComponent(lblGRADE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
                        .addGap(18, 18, 18)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(btnEXIT)
                            .addComponent(jLabel8, javax.swing.GroupLayout.PREFERRED_SIZE, 80, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addGroup(layout.createSequentialGroup()
                                .addGap(26, 26, 26)
                                .addComponent(jLabel9, javax.swing.GroupLayout.PREFERRED_SIZE, 15, javax.swing.GroupLayout.PREFERRED_SIZE)))))
                .addContainerGap(28, Short.MAX_VALUE))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jLabel1)
                .addGap(22, 22, 22)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel2)
                    .addComponent(txtNIM, 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(jLabel3)
                    .addComponent(txtNAMA, 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(jLabel4)
                    .addComponent(txtIPK, 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.LEADING)
                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(jLabel5)
                        .addComponent(bANGKATAN))
                    .addComponent(jLabel8, javax.swing.GroupLayout.Alignment.TRAILING))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel6)
                    .addComponent(lblJURUSAN)
                    .addComponent(jLabel9))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel7)
                    .addComponent(lblGRADE))
                .addGap(30, 30, 30)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(btnKALKULASI)
                    .addComponent(btnSIMPAN)
                    .addComponent(btnRESET)
                    .addComponent(btnEXIT))
                .addContainerGap(36, Short.MAX_VALUE))
        );

        jLabel2.getAccessibleContext().setAccessibleName("");

        pack();
    }// </editor-fold>                       

    private void btnKALKULASIActionPerformed(java.awt.event.ActionEvent evt) {                                            
        // TODO add your handling code here:
          Mahasiswa mahasiswa = new Mahasiswa();
       
        mahasiswa.setNim(txtNIM.getText());
        mahasiswa.setNama(txtNAMA.getText());
        mahasiswa.setIPK(Float.parseFloat(txtIPK.getText()));
       
        bANGKATAN.setText(mahasiswa.getAngkatan());
        lblJURUSAN.setText(mahasiswa.getJurusan());


    }                                           

    private void btnSIMPANActionPerformed(java.awt.event.ActionEvent evt) {                                         
        // TODO add your handling code here:
        Mahasiswa mahasiswa = new Mahasiswa();
       
        mahasiswa.setNim(txtNIM.getText());
        mahasiswa.setNama(txtNAMA.getText());
        mahasiswa.setIPK(Float.parseFloat(txtIPK.getText()));
       
        daftar.add(mahasiswa);
        jLabel9.setText(String.valueOf(daftar.size()));
       
        btnRESETActionPerformed(null);
        lblGRADE.setText(mahasiswa.getGrade());
    }                                        

    private void btnRESETActionPerformed(java.awt.event.ActionEvent evt) {                                        
        // TODO add your handling code here:
        txtNIM.setText("");
        txtNAMA.setText("");
        txtIPK.setText("");
        jLabel5.setText("");
        jLabel6.setText("");
        jLabel7.setText("");

        txtNIM.requestFocus();

    }                                       

    private void btnEXITActionPerformed(java.awt.event.ActionEvent evt) {                                       
        // TODO add your handling code here:
        this.setVisible(false);
        System.exit(0);

    }                                      

    /**
     * @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(FormMahasiswa.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(FormMahasiswa.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(FormMahasiswa.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(FormMahasiswa.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 FormMahasiswa().setVisible(true);
            }
        });
    }

    // Variables declaration - do not modify                    
    private javax.swing.JLabel bANGKATAN;
    private javax.swing.JButton btnEXIT;
    private javax.swing.JButton btnKALKULASI;
    private javax.swing.JButton btnRESET;
    private javax.swing.JButton btnSIMPAN;
    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.JLabel jLabel9;
    private javax.swing.JLabel lblGRADE;
    private javax.swing.JLabel lblJURUSAN;
    private javax.swing.JTextField txtIPK;
    private javax.swing.JTextField txtNAMA;
    private javax.swing.JTextField txtNIM;
    // End of variables declaration                  
}
 



Hasil Jadinya Dijalankan Dengan Program Java


Disqus Shortname

Comments system