Senin, 24 April 2017

/*
 * 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 Harga extends javax.swing.JFrame {

    /**
     * Creates new form Harga
     */
    public Harga() {
        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();
        buttonGroup2 = new javax.swing.ButtonGroup();
        jLabel1 = new javax.swing.JLabel();
        RBCokelat = new javax.swing.JRadioButton();
        buttonGroup1.add(RBCokelat);
        RBStrawberry = new javax.swing.JRadioButton();
        buttonGroup1.add(RBStrawberry);
        RBVanila = new javax.swing.JRadioButton();
        buttonGroup1.add(RBVanila);
        RBMatcha = new javax.swing.JRadioButton();
        buttonGroup1.add(RBMatcha);
        jLabel2 = new javax.swing.JLabel();
        CBDiskon = new javax.swing.JCheckBox();
        TextHarga = new javax.swing.JTextField();
        TextDiskon = new javax.swing.JTextField();
        jLabel3 = new javax.swing.JLabel();
        RBKokoCrunch = new javax.swing.JRadioButton();
        buttonGroup1.add(RBKokoCrunch);
        RBOreo = new javax.swing.JRadioButton();
        buttonGroup1.add(RBOreo);
        TextTopping = new javax.swing.JTextField();
        jLabel4 = new javax.swing.JLabel();
        TextTotalHarga = new javax.swing.JTextField();
        TextHarga2 = new javax.swing.JTextField();
        jLabel5 = new javax.swing.JLabel();
        TotalHarga = new javax.swing.JButton();
        TextRasaIceCream = new javax.swing.JTextField();
        jLabel6 = new javax.swing.JLabel();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

        jLabel1.setText("Rasa Ice Cream");

        RBCokelat.setText("Cokelat");
        RBCokelat.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                RBCokelatActionPerformed(evt);
            }
        });

        RBStrawberry.setText("Strawberry");
        RBStrawberry.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                RBStrawberryActionPerformed(evt);
            }
        });

        RBVanila.setText("Vanila");
        RBVanila.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                RBVanilaActionPerformed(evt);
            }
        });

        RBMatcha.setText("Matcha");
        RBMatcha.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                RBMatchaActionPerformed(evt);
            }
        });

        jLabel2.setText("Harga");

        CBDiskon.setText("Diskon 10%");
        CBDiskon.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                CBDiskonActionPerformed(evt);
            }
        });

        jLabel3.setText("Topping");

        RBKokoCrunch.setText("Koko Crunch");
        RBKokoCrunch.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                RBKokoCrunchActionPerformed(evt);
            }
        });

        RBOreo.setText("Oreo");
        RBOreo.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                RBOreoActionPerformed(evt);
            }
        });

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

        jLabel5.setText("Harga Tambah Topping");

        TotalHarga.setText("Total Harga");
        TotalHarga.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                TotalHargaActionPerformed(evt);
            }
        });

        jLabel6.setFont(new java.awt.Font("Trebuchet MS", 0, 18)); // NOI18N
        jLabel6.setText("Aneka macam rasa ice cream");

        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(119, 119, 119)
                        .addComponent(jLabel4, javax.swing.GroupLayout.PREFERRED_SIZE, 43, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(layout.createSequentialGroup()
                        .addGap(66, 66, 66)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                            .addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 111, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel5))
                        .addGap(119, 119, 119)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                            .addComponent(TextHarga2, javax.swing.GroupLayout.PREFERRED_SIZE, 85, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(TextHarga, javax.swing.GroupLayout.PREFERRED_SIZE, 85, javax.swing.GroupLayout.PREFERRED_SIZE))))
                .addGap(52, 52, 52)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(TotalHarga, javax.swing.GroupLayout.PREFERRED_SIZE, 89, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 82, Short.MAX_VALUE)
                        .addComponent(TextTotalHarga, javax.swing.GroupLayout.PREFERRED_SIZE, 87, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(CBDiskon)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addComponent(TextDiskon, javax.swing.GroupLayout.PREFERRED_SIZE, 85, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addGap(36, 36, 36))
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(RBCokelat, javax.swing.GroupLayout.PREFERRED_SIZE, 75, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addGroup(layout.createSequentialGroup()
                                .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 90, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addGap(57, 57, 57)
                                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(jLabel6, javax.swing.GroupLayout.PREFERRED_SIZE, 252, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addComponent(TextRasaIceCream, javax.swing.GroupLayout.PREFERRED_SIZE, 79, javax.swing.GroupLayout.PREFERRED_SIZE))))
                        .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                        .addComponent(RBMatcha, javax.swing.GroupLayout.PREFERRED_SIZE, 79, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                            .addGroup(layout.createSequentialGroup()
                                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(RBOreo, javax.swing.GroupLayout.PREFERRED_SIZE, 71, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addComponent(RBKokoCrunch))
                                .addGap(228, 228, 228))
                            .addGroup(layout.createSequentialGroup()
                                .addComponent(jLabel3, javax.swing.GroupLayout.PREFERRED_SIZE, 64, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                .addComponent(TextTopping, javax.swing.GroupLayout.PREFERRED_SIZE, 87, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addGap(57, 57, 57))))
                    .addGroup(layout.createSequentialGroup()
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(RBStrawberry)
                            .addComponent(RBVanila, javax.swing.GroupLayout.PREFERRED_SIZE, 79, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(0, 0, Short.MAX_VALUE))))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGap(31, 31, 31)
                .addComponent(jLabel6, javax.swing.GroupLayout.PREFERRED_SIZE, 53, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(32, 32, 32)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(TextRasaIceCream, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel1))
                .addGap(29, 29, 29)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                            .addGroup(layout.createSequentialGroup()
                                .addComponent(RBCokelat)
                                .addGap(27, 27, 27)
                                .addComponent(RBStrawberry)
                                .addGap(39, 39, 39)
                                .addComponent(jLabel4))
                            .addComponent(RBVanila))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 10, Short.MAX_VALUE)
                        .addComponent(RBMatcha)
                        .addGap(18, 18, 18))
                    .addGroup(layout.createSequentialGroup()
                        .addGap(33, 33, 33)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel3, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(TextTopping, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(18, 18, 18)
                        .addComponent(RBOreo)
                        .addGap(18, 18, 18)
                        .addComponent(RBKokoCrunch)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel2)
                            .addComponent(TextHarga, javax.swing.GroupLayout.PREFERRED_SIZE, 26, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(18, 18, 18))
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(CBDiskon)
                            .addComponent(TextDiskon, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(32, 32, 32)))
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel5)
                            .addComponent(TextHarga2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(75, 75, 75))
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(TotalHarga)
                            .addComponent(TextTotalHarga, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(81, 81, 81))))
        );

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

    private void RBStrawberryActionPerformed(java.awt.event.ActionEvent evt) {                                            
        // TODO add your handling code here:
        TextRasaIceCream.setText(""+RBStrawberry.getText());
        TextHarga.setText(""+55000);
    }                                           

    private void RBCokelatActionPerformed(java.awt.event.ActionEvent evt) {                                         
        // TODO add your handling code here:
        TextRasaIceCream.setText(""+RBCokelat.getText());
        TextHarga.setText(""+50000);
    }                                        

    private void RBVanilaActionPerformed(java.awt.event.ActionEvent evt) {                                        
        // TODO add your handling code here:
        TextRasaIceCream.setText(""+RBVanila.getText());
        TextHarga.setText(""+45000);
    }                                       

    private void RBMatchaActionPerformed(java.awt.event.ActionEvent evt) {                                        
        // TODO add your handling code here:
        TextRasaIceCream.setText(""+RBMatcha.getText());
        TextHarga.setText(""+60000);
    }                                       

    private void CBDiskonActionPerformed(java.awt.event.ActionEvent evt) {                                        
        // TODO add your handling code here:
        if(CBDiskon.isSelected()){
            int harga=Integer.parseInt(TextHarga.getText());
            int Diskon=harga/10;
            TextDiskon.setText(""+Diskon);
        }else{
            TextDiskon.setText(""+0);
        }
    }                                       

    private void RBKokoCrunchActionPerformed(java.awt.event.ActionEvent evt) {                                            
        // TODO add your handling code here:
        TextTopping.setText(""+RBKokoCrunch.getText());
        TextHarga2.setText(""+10000);
    }                                           

    private void RBOreoActionPerformed(java.awt.event.ActionEvent evt) {                                      
        // TODO add your handling code here:
        TextTopping.setText(""+RBOreo.getText());
        TextHarga2.setText(""+10000);
    }                                     

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

    private void TotalHargaActionPerformed(java.awt.event.ActionEvent evt) {                                          
        // TODO add your handling code here:
        int bil1=Integer.parseInt(TextHarga.getText());
        int bil2=Integer.parseInt(TextHarga2.getText());
        int bil3=Integer.parseInt(TextDiskon.getText());
        int hasil=bil1+bil2-bil3;
        TextTotalHarga.setText(""+hasil);
    }                                         

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

    // Variables declaration - do not modify                    
    private javax.swing.JCheckBox CBDiskon;
    private javax.swing.JRadioButton RBCokelat;
    private javax.swing.JRadioButton RBKokoCrunch;
    private javax.swing.JRadioButton RBMatcha;
    private javax.swing.JRadioButton RBOreo;
    private javax.swing.JRadioButton RBStrawberry;
    private javax.swing.JRadioButton RBVanila;
    private javax.swing.JTextField TextDiskon;
    private javax.swing.JTextField TextHarga;
    private javax.swing.JTextField TextHarga2;
    private javax.swing.JTextField TextRasaIceCream;
    private javax.swing.JTextField TextTopping;
    private javax.swing.JTextField TextTotalHarga;
    private javax.swing.JButton TotalHarga;
    private javax.swing.ButtonGroup buttonGroup1;
    private javax.swing.ButtonGroup buttonGroup2;
    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;
    // End of variables declaration                  
}

Tidak ada komentar:

Posting Komentar

Database Pemesanan Hotel

07SIFP001 UAS AUDIT TI Rika Oktafiani Rasyid 161011700377 Pada postingan ini saya akan membuat audit database pemesanan hotel meng...