Rabu, 31 Oktober 2012

java (net beans)





 

package thonbadawi.aji;
import javax.swing.JOptionPane;
public class sakit extends javax.swing.JFrame {
String no,ruang;
int total,anak,dewasa,lama;
    /** Creates new form sakit */
    public sakit() {
        initComponents();
    }
    private void bkeluarActionPerformed(java.awt.event.ActionEvent evt) {                                       
        // TODO add your handling code here:
int a=JOptionPane.showConfirmDialog(null,"Ingin Keluar","informasi",JOptionPane.OK_CANCEL_OPTION);
if (a==JOptionPane.OK_OPTION)
    System.exit(0);
else
    return;
    }                                      

    private void ckkActionPerformed(java.awt.event.ActionEvent evt) {                                   
        // TODO add your handling code here:
no = ckk.getSelectedItem().toString();
if (no.equalsIgnoreCase("1")){ej.setText("VIP");
cr.removeAllItems();
cr.addItem("pilih...");
cr.addItem("CAPRICORN");
cr.addItem("SAGITARIUS");
cr.addItem("CANCER");}
else if (no.equalsIgnoreCase("2")){ej.setText("EKSEKUTIF");
cr.removeAllItems();
cr.addItem("pilih...");
cr.addItem("LIBRA");
cr.addItem("GEMINI");
cr.addItem("SCORPIO");}
else {ej.setText("EKONOMI");
cr.removeAllItems();
cr.addItem("pilih...");
cr.addItem("TAURUS");
cr.addItem("LEO");
cr.addItem("ARIES");}
    }                                  

    private void bbersihActionPerformed(java.awt.event.ActionEvent evt) {                                       
        // TODO add your handling code here:
enp.setText("");
ckk.setSelectedIndex(0);
ej.setText("");
cr.setSelectedItem(false);
cka.setSelected(false);
ckd.setSelected(false);
el.setText("");
etk.setText("");
etb.setText("");
    }                                      

    private void ckaActionPerformed(java.awt.event.ActionEvent evt) {                                   
        // TODO add your handling code here:
ruang = cr.getSelectedItem().toString();
if      (ruang.equalsIgnoreCase("CAPRICORN"))
        {if(cka.isSelected()==true)
        {anak = 400000;}else {anak = 0;}}
else if (ruang.equalsIgnoreCase("SAGITARIUS"))
        {if (cka.isSelected()==true)
        {anak = 350000;}else {anak = 0;}}
else if (ruang.equalsIgnoreCase("CANCER"))  
        {if (cka.isSelected()==true)
        {anak = 300000;}else {anak = 0;}}
else if (ruang.equalsIgnoreCase("LIBRA"))  
        {if (cka.isSelected()==true)
        {anak = 250000;}else {anak = 0;}}
else if (ruang.equalsIgnoreCase("GEMINI"))  
        {if (cka.isSelected()==true)
        {anak = 200000;}else {anak = 0;}}
else if (ruang.equalsIgnoreCase("SCORPIO"))  
        {if (cka.isSelected()==true)
        {anak = 150000;}else {anak = 0;}}
else if (ruang.equalsIgnoreCase("TAURUS"))  
        {if (cka.isSelected()==true)
        {anak = 80000;}else  {anak = 0;}}
else if (ruang.equalsIgnoreCase("LEO"))  
        {if (cka.isSelected()==true)
        {anak = 50000;}else {anak = 0;}}
else    {if (cka.isSelected()==true)
        {anak = 30000;}else {anak = 0;}}
etk.setText(String.valueOf(anak));
    }                                  

    private void ckdActionPerformed(java.awt.event.ActionEvent evt) {                                   
        // TODO add your handling code here:
ruang = cr.getSelectedItem().toString();
if      (ruang.equalsIgnoreCase("CAPRICORN"))
        {if(ckd.isSelected()==true)
        {dewasa = 1000000;}else {dewasa = 0;}}
else if (ruang.equalsIgnoreCase("SAGITARIUS"))
        {if (ckd.isSelected()==true)
        {dewasa = 950000;}else {dewasa = 0;}}
else if (ruang.equalsIgnoreCase("CANCER"))  
        {if (ckd.isSelected()==true)
        {dewasa = 900000;}else {dewasa = 0;}}
else if (ruang.equalsIgnoreCase("LIBRA"))  
        {if (ckd.isSelected()==true)
        {dewasa = 850000;}else {dewasa = 0;}}
else if (ruang.equalsIgnoreCase("GEMINI"))  
        {if (ckd.isSelected()==true)
        {dewasa = 800000;}else {dewasa = 0;}}
else if (ruang.equalsIgnoreCase("SCORPIO"))  
        {if (ckd.isSelected()==true)
        {dewasa = 750000;}else {dewasa = 0;}}
else if (ruang.equalsIgnoreCase("TAURUS"))  
        {if (ckd.isSelected()==true)
        {dewasa = 700000;}else {dewasa = 0;}}
else if (ruang.equalsIgnoreCase("LEO"))  
        {if (ckd.isSelected()==true)
        {dewasa = 650000;}else {dewasa = 0;}}
else    {if (ckd.isSelected()==true)
        {dewasa = 600000;}else {dewasa = 0;}}
etk.setText(String.valueOf(dewasa));
    }                                  

    private void elActionPerformed(java.awt.event.ActionEvent evt) {                                  
        // TODO add your handling code here:
lama = Integer.parseInt(el.getText());
total = lama * (anak + dewasa);
etb.setText(String.valueOf(total));
    }


**sopan santun dalam tutur kata ialah pibadi yang baik**