domingo, 29 de mayo de 2011

PROFORMA PARA VENDER PRODUCTOS CON JCOMBOX

public class ejercicio1 extends javax.swing.JFrame {
private void jcbotecladoActionPerformed(java.awt.event.ActionEvent evt) {                                           
        // TODO add your handling code here:
        int entrada =(this.jcboteclado.getSelectedIndex());
        switch (entrada){
            case 0: jtxtp2.setText("25");break;
            case 1: jtxtp2.setText("70");break;
        }
    }                                          

    private void jcbomonitorActionPerformed(java.awt.event.ActionEvent evt) {                                           
        // TODO add your handling code here:
        int entrada =(this.jcbomonitor.getSelectedIndex());
        switch (entrada){
            case 0: jtxtp1.setText("600");break;
            case 1: jtxtp1.setText("1300");break;
        }
    }                                          

    private void jcbocpuActionPerformed(java.awt.event.ActionEvent evt) {                                       
        // TODO add your handling code here:
        int entrada =(this.jcbocpu.getSelectedIndex());
        switch (entrada){
            case 0: jtxtp3.setText("600");break;
            case 1: jtxtp3.setText("800");break;
        }
    }                                      

    private void jcbomouseActionPerformed(java.awt.event.ActionEvent evt) {                                         
        // TODO add your handling code here:
        int entrada =(this.jcbomouse.getSelectedIndex());
        switch (entrada){
            case 0: jtxtp4.setText("30");break;
            case 1: jtxtp4.setText("60");break;
        }
    }                                        

    private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {                                        
        // TODO add your handling code here:
        String e=this.jtxtp1.getText();
            int p1=Integer.parseInt(e);
        e=this.jtxtc1.getText();
            int c1=Integer.parseInt(e);
        int imp1=(p1*c1);
        this.jtxtimp1.setText(""+imp1);
        e=this.jtxtp2.getText();
            int p2=Integer.parseInt(e);
        e=this.jtxtc2.getText();
            int c2=Integer.parseInt(e);
        int imp2=(p2*c2);
        this.jtxtimp2.setText(""+imp2);
        e=this.jtxtp3.getText();
            int p3=Integer.parseInt(e);
        e=this.jtxtc3.getText();
            int c3=Integer.parseInt(e);
        int imp3=(p3*c3);
        this.jtxtimp3.setText(""+imp3);
        e=this.jtxtp4.getText();
            int p4=Integer.parseInt(e);
        e=this.jtxtc4.getText();
            int c4=Integer.parseInt(e);
        int imp4=(p4*c4);
        this.jtxtimp4.setText(""+imp4);
        int st=(imp1+imp2+imp3+imp4);
        this.jtxtST.setText(""+st);
        double igv=(st*0.18);
        this.jtxtigv.setText(""+igv);
        double neto=(st+igv);
        this.jtxtn.setText(""+neto);
    }                                       

    /**
    * @param args the command line arguments
    */
    public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new ejercicio1().setVisible(true);
            }
        });
    } 

No hay comentarios:

Publicar un comentario