private void btnprocesarActionPerformed(java.awt.event.ActionEvent evt) {
     // TODO add your handling code here:
     String sb;
     sb=txtsb.getText(); //consigue el dato de la caja
     double ssb=Double.parseDouble(sb);

      String faltas;
      faltas=txtf.getText(); //consigue el dato de la caja
      double ffaltas=Double.parseDouble(faltas);

      //Calcular el descuento
      double d;
      d=ssb/30*2*ffaltas;
      double np;
      np=ssb-d;
      //Convertirlo a String para mostrarlo
      txtd.setText(String.valueOf(d));
      txtnp.setText(String.valueOf(np));
  }

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

  private void btnlimpiarActionPerformed(java.awt.event.ActionEvent
  evt) {
       // TODO add your handling code here:
       txtsb.setText("");
       txtf.setText("");
       txtd.setText("");
       txtnp.setText("");
       txtsb.requestFocus();
    }
Img1

Img1

  • 1.
    private void btnprocesarActionPerformed(java.awt.event.ActionEventevt) { // TODO add your handling code here: String sb; sb=txtsb.getText(); //consigue el dato de la caja double ssb=Double.parseDouble(sb); String faltas; faltas=txtf.getText(); //consigue el dato de la caja double ffaltas=Double.parseDouble(faltas); //Calcular el descuento double d; d=ssb/30*2*ffaltas; double np; np=ssb-d; //Convertirlo a String para mostrarlo txtd.setText(String.valueOf(d)); txtnp.setText(String.valueOf(np)); } private void btncerrarActionPerformed(java.awt.event.ActionEvent evt) { // TODO add your handling code here: dispose(); } private void btnlimpiarActionPerformed(java.awt.event.ActionEvent evt) { // TODO add your handling code here: txtsb.setText(""); txtf.setText(""); txtd.setText(""); txtnp.setText(""); txtsb.requestFocus(); }