Laman

Selamat Datang Sahabat! Selamat ber-sharing Ilmu Komputer

Sabtu, 28 Desember 2013

Java Program : JFrame Form Terstruktur

Design Form tersebut diatas! Dengan Class Name: FormJualMobil

Tuliskan Listing berikut dibawah "Package"

import javax.swing.JOptionPane;

public class FormJualMobil extends javax.swing.JFrame {
    private int hrg, ttl, ac, central, kaca;
    private String merk;

 public FormJualMobil() {
        initComponents();
        setLocationRelativeTo(this);
    }

 private void bkeluarActionPerformed(java.awt.event.ActionEvent evt) {                                        
  System.exit(0);
    }                                       

    private void bbersihActionPerformed(java.awt.event.ActionEvent evt) {                                        
        cbkode.setSelectedItem("-PILIH-");
        tmerk.setText("");
        tharga.setText("");
        tac.setText("");
        tcentral.setText("");
        tkaca.setText("");
        ttotal.setText("");
        cac.setSelected(false);
        ccentral.setSelected(false);
        ckaca.setSelected(false);
    }                                       

    private void cbkodeActionPerformed(java.awt.event.ActionEvent evt) {                                       
        if (cbkode.getSelectedItem().equals("MAV01"))
           { merk="AVANZA";
            hrg=125000000;}
        else if (cbkode.getSelectedItem().equals("MXE02"))
           { merk="XENIA";
            hrg=115000000;}
         else if (cbkode.getSelectedItem().equals("MIN03"))
           { merk="INOVA";
            hrg=135000000;}
        tmerk.setText(merk);
        tharga.setText(String.valueOf(hrg));
        total();
        ttotal.setText(String.valueOf(ttl));
    }                                      

    private void cacActionPerformed(java.awt.event.ActionEvent evt) {                                    
        if (cac.isSelected()==true )
        { ac=20000; }
        else {ac=0;}
        tac.setText(String.valueOf(ac));
         total();
         ttotal.setText(String.valueOf(ttl));
    }                                   

    private void ccentralActionPerformed(java.awt.event.ActionEvent evt) {                                         
        if (ccentral.isSelected()==true )
        { central=10000; }
        else {central=0;}
        tcentral.setText(String.valueOf(central));
         total();
         ttotal.setText(String.valueOf(ttl));
    }                                        

    private void ckacaActionPerformed(java.awt.event.ActionEvent evt) {                                      
       if (ckaca.isSelected()==true )
        { kaca=20000; }
        else {kaca=0;}
        tkaca.setText(String.valueOf(kaca));
         total();
         ttotal.setText(String.valueOf(ttl));
    }                                     

    void total()
    { ttl=hrg+ac+kaca+central; }

1 komentar:

  1. If you're trying to burn fat then you have to start following this totally brand new custom keto diet.

    To create this keto diet service, certified nutritionists, personal trainers, and cooks have joined together to provide keto meal plans that are effective, painless, money-efficient, and delicious.

    Since their first launch in January 2019, hundreds of individuals have already completely transformed their figure and well-being with the benefits a smart keto diet can give.

    Speaking of benefits: clicking this link, you'll discover 8 scientifically-tested ones provided by the keto diet.

    BalasHapus