Ini Source Code Untuk Program Diatas

/*
 * 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 User
 */
public class HomenetHilman extends javax.swing.JFrame {

    /**
     * Creates new form HomenetHilman
     */
    public HomenetHilman() {
        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();
        RBMouse = new javax.swing.JRadioButton();
        buttonGroup1.add(RBMouse);
        RBKeyboard = new javax.swing.JRadioButton();
        buttonGroup1.add(RBKeyboard);
        RBSpeaker = new javax.swing.JRadioButton();
        buttonGroup1.add(RBSpeaker);
        RBCPU = new javax.swing.JRadioButton();
        buttonGroup1.add(RBCPU);
        RBMonitor = new javax.swing.JRadioButton();
        buttonGroup1.add(RBMonitor);
        jLabel2 = new javax.swing.JLabel();
        jLabel3 = new javax.swing.JLabel();
        TextBarang = new javax.swing.JTextField();
        TextTotal = new javax.swing.JTextField();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

        jLabel1.setText("HomenetHilman");

        RBMouse.setText("Mouse");
        RBMouse.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                RBMouseActionPerformed(evt);
            }
        });

        RBKeyboard.setText("Keyboard");
        RBKeyboard.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                RBKeyboardActionPerformed(evt);
            }
        });

        RBSpeaker.setText("Speaker");
        RBSpeaker.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                RBSpeakerActionPerformed(evt);
            }
        });

        RBCPU.setText("CPU");
        RBCPU.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                RBCPUActionPerformed(evt);
            }
        });

        RBMonitor.setText("Monitor");
        RBMonitor.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                RBMonitorActionPerformed(evt);
            }
        });

        jLabel2.setText("Barang");

        jLabel3.setText("Total");

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(RBSpeaker)
                    .addComponent(RBCPU)
                    .addComponent(RBMonitor)
                    .addGroup(layout.createSequentialGroup()
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(RBMouse)
                            .addComponent(RBKeyboard))
                        .addGap(79, 79, 79)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(layout.createSequentialGroup()
                                .addComponent(jLabel2)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 92, Short.MAX_VALUE)
                                .addComponent(TextBarang, javax.swing.GroupLayout.PREFERRED_SIZE, 94, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addGroup(layout.createSequentialGroup()
                                .addComponent(jLabel1)
                                .addGap(0, 0, Short.MAX_VALUE))
                            .addGroup(layout.createSequentialGroup()
                                .addComponent(jLabel3)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                .addComponent(TextTotal, javax.swing.GroupLayout.PREFERRED_SIZE, 94, javax.swing.GroupLayout.PREFERRED_SIZE)))))
                .addGap(24, 24, 24))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(jLabel1)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(RBMouse))
                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(jLabel2)
                        .addComponent(TextBarang, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addGap(18, 18, 18)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(RBKeyboard)
                    .addComponent(jLabel3)
                    .addComponent(TextTotal, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addComponent(RBSpeaker)
                .addGap(18, 18, 18)
                .addComponent(RBCPU)
                .addGap(18, 18, 18)
                .addComponent(RBMonitor)
                .addGap(0, 92, Short.MAX_VALUE))
        );

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

    private void RBKeyboardActionPerformed(java.awt.event.ActionEvent evt) {                                           
        // TODO add your handling code here:
        TextBarang.setText(""+RBKeyboard.getText());
        TextTotal.setText(""+100000);
    }                                          

    private void RBMouseActionPerformed(java.awt.event.ActionEvent evt) {                                        
        // TODO add your handling code here:
        TextBarang.setText(""+RBMouse.getText());
        TextTotal.setText(""+70000);
    }                                       

    private void RBSpeakerActionPerformed(java.awt.event.ActionEvent evt) {                                          
        // TODO add your handling code here:
        TextBarang.setText(""+RBSpeaker.getText());
        TextTotal.setText(""+100000);
        
    }                                         

    private void RBCPUActionPerformed(java.awt.event.ActionEvent evt) {                                      
        // TODO add your handling code here:
        TextBarang.setText(""+RBCPU.getText());
        TextTotal.setText(""+1000000);
        
    }                                     

    private void RBMonitorActionPerformed(java.awt.event.ActionEvent evt) {                                          
        // TODO add your handling code here:
        TextBarang.setText(""+RBMonitor.getText());
        TextTotal.setText(""+800000);
        
    }                                         

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

    // Variables declaration - do not modify                     
    private javax.swing.JRadioButton RBCPU;
    private javax.swing.JRadioButton RBKeyboard;
    private javax.swing.JRadioButton RBMonitor;
    private javax.swing.JRadioButton RBMouse;
    private javax.swing.JRadioButton RBSpeaker;
    private javax.swing.JTextField TextBarang;
    private javax.swing.JTextField TextTotal;
    private javax.swing.ButtonGroup buttonGroup1;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    // End of variables declaration                   
}


Komentar

Postingan populer dari blog ini

Data client perusahaan

Jual berbagai jenis-jenis vespa menggunakan aplikasi visual studio/visual basic