private void btncalcularActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btncalcularActionPerformed
       int x,r,vali,valf;
       vali=Integer.parseInt(txtinicial.getText());
       valf=Integer.parseInt(txtfinal.getText());
       
       if(rbtnpar.isSelected()){
       x=0;
       String n;
       
       for(int i=vali;i<=valf;i++){
       n=String.valueOf(i);
       
        if(i%2==0){
            x=x+1;
        }
       }
       }else{
           x=0;
           for(int i=vali;i<=valf;i++){
           if(i%2==0){
           
           }else{
               x=x+1;
           }
           }
       }
       txtresultado.setText(String.valueOf(x));
    }//GEN-LAST:event_btncalcularActionPerformed