content: /*
   * To change this license header, choose License Headers in Project Properties.
   * To change this template file, choose Tools | Templates
   * and open the template in the editor.
   */
  package calcul;
  
  /**
   *
   * @author pc
   */
  public class calcuul extends javax.swing.JFrame {
      private double x,y;
      private String op;
      private boolean eg=false;
      private boolean ver=false;
      
      
      /**
       * Creates new form NewJFrame
       */
      public calcuul() {
          initComponents();
          jTextField1.setText("0");
      }
  
      /**
       * This method is called from within the constructor to initialize the form.
       * WARNING: Do NOT modify this code. The content of this method is always
       * regenerated by the Form Editor.
       */
      @SuppressWarnings("unchecked")
      // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
      private void initComponents() {
  
          jTextField1 = new javax.swing.JTextField();
          jButton13 = new javax.swing.JButton();
          jButton14 = new javax.swing.JButton();
          jButton15 = new javax.swing.JButton();
          jButton16 = new javax.swing.JButton();
          jButton17 = new javax.swing.JButton();
          jButton18 = new javax.swing.JButton();
          jButton19 = new javax.swing.JButton();
          jButton20 = new javax.swing.JButton();
          jButton21 = new javax.swing.JButton();
          jButton22 = new javax.swing.JButton();
          jButton23 = new javax.swing.JButton();
          jButton24 = new javax.swing.JButton();
          jButton25 = new javax.swing.JButton();
          jButton26 = new javax.swing.JButton();
          jButton27 = new javax.swing.JButton();
          jButton28 = new javax.swing.JButton();
  
          setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
  
          jTextField1.addActionListener(new java.awt.event.ActionListener() {
              public void actionPerformed(java.awt.event.ActionEvent evt) {
                  jTextField1ActionPerformed(evt);
              }
          });
  
          jButton13.setText("1");
          jButton13.addActionListener(new java.awt.event.ActionListener() {
              public void actionPerformed(java.awt.event.ActionEvent evt) {
                  jButton13ActionPerformed(evt);
              }
          });
  
          jButton14.setText("0");
          jButton14.addActionListener(new java.awt.event.ActionListener() {
              public void actionPerformed(java.awt.event.ActionEvent evt) {
                  jButton14ActionPerformed(evt);
              }
          });
  
          jButton15.setText("4");
          jButton15.addActionListener(new java.awt.event.ActionListener() {
              public void actionPerformed(java.awt.event.ActionEvent evt) {
                  jButton15ActionPerformed(evt);
              }
          });
  
          jButton16.setText("*");
          jButton16.addActionListener(new java.awt.event.ActionListener() {
              public void actionPerformed(java.awt.event.ActionEvent evt) {
                  jButton16ActionPerformed(evt);
              }
          });
  
          jButton17.setText("+");
          jButton17.addActionListener(new java.awt.event.ActionListener() {
              public void actionPerformed(java.awt.event.ActionEvent evt) {
                  jButton17ActionPerformed(evt);
              }
          });
  
          jButton18.setText("-");
          jButton18.addActionListener(new java.awt.event.ActionListener() {
              public void actionPerformed(java.awt.event.ActionEvent evt) {
                  jButton18ActionPerformed(evt);
              }
          });
  
          jButton19.setText("6");
          jButton19.addActionListener(new java.awt.event.ActionListener() {
              public void actionPerformed(java.awt.event.ActionEvent evt) {
                  jButton19ActionPerformed(evt);
              }
          });
  
          jButton20.setText("3");
          jButton20.addActionListener(new java.awt.event.ActionListener() {
              public void actionPerformed(java.awt.event.ActionEvent evt) {
                  jButton20ActionPerformed(evt);
              }
          });
  
          jButton21.setText("=");
          jButton21.addActionListener(new java.awt.event.ActionListener() {
              public void actionPerformed(java.awt.event.ActionEvent evt) {
                  jButton21ActionPerformed(evt);
              }
          });
  
          jButton22.setText("5");
          jButton22.addActionListener(new java.awt.event.ActionListener() {
              public void actionPerformed(java.awt.event.ActionEvent evt) {
                  jButton22ActionPerformed(evt);
              }
          });
  
          jButton23.setText("2");
          jButton23.addActionListener(new java.awt.event.ActionListener() {
              public void actionPerformed(java.awt.event.ActionEvent evt) {
                  jButton23ActionPerformed(evt);
              }
          });
  
          jButton24.setText("7");
          jButton24.addActionListener(new java.awt.event.ActionListener() {
              public void actionPerformed(java.awt.event.ActionEvent evt) {
                  jButton24ActionPerformed(evt);
              }
          });
  
          jButton25.setText("/");
          jButton25.addActionListener(new java.awt.event.ActionListener() {
              public void actionPerformed(java.awt.event.ActionEvent evt) {
                  jButton25ActionPerformed(evt);
              }
          });
  
          jButton26.setText(".");
          jButton26.addActionListener(new java.awt.event.ActionListener() {
              public void actionPerformed(java.awt.event.ActionEvent evt) {
                  jButton26ActionPerformed(evt);
              }
          });
  
          jButton27.setText("8");
          jButton27.addActionListener(new java.awt.event.ActionListener() {
              public void actionPerformed(java.awt.event.ActionEvent evt) {
                  jButton27ActionPerformed(evt);
              }
          });
  
          jButton28.setText("9");
          jButton28.addActionListener(new java.awt.event.ActionListener() {
              public void actionPerformed(java.awt.event.ActionEvent evt) {
                  jButton28ActionPerformed(evt);
              }
          });
  
          javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
          getContentPane().setLayout(layout);
          layout.setHorizontalGroup(
              layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
              .addGroup(layout.createSequentialGroup()
                  .addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, 318, javax.swing.GroupLayout.PREFERRED_SIZE)
                  .addGap(0, 11, Short.MAX_VALUE))
              .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                  .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                      .addComponent(jButton15, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                      .addComponent(jButton24, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                      .addComponent(jButton13, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                      .addComponent(jButton14, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                  .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                      .addComponent(jButton26, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                      .addComponent(jButton27, javax.swing.GroupLayout.DEFAULT_SIZE, 75, Short.MAX_VALUE)
                      .addComponent(jButton22, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                      .addComponent(jButton23, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                  .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                      .addGroup(layout.createSequentialGroup()
                          .addComponent(jButton21, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                          .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                          .addComponent(jButton18, javax.swing.GroupLayout.PREFERRED_SIZE, 76, javax.swing.GroupLayout.PREFERRED_SIZE))
                      .addGroup(layout.createSequentialGroup()
                          .addComponent(jButton20, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                          .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                          .addComponent(jButton17, javax.swing.GroupLayout.PREFERRED_SIZE, 76, javax.swing.GroupLayout.PREFERRED_SIZE))
                      .addGroup(layout.createSequentialGroup()
                          .addComponent(jButton28, javax.swing.GroupLayout.PREFERRED_SIZE, 75, javax.swing.GroupLayout.PREFERRED_SIZE)
                          .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                          .addComponent(jButton25, javax.swing.GroupLayout.PREFERRED_SIZE, 76, javax.swing.GroupLayout.PREFERRED_SIZE))
                      .addGroup(layout.createSequentialGroup()
                          .addComponent(jButton19, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                          .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                          .addComponent(jButton16, javax.swing.GroupLayout.PREFERRED_SIZE, 76, javax.swing.GroupLayout.PREFERRED_SIZE))))
          );
          layout.setVerticalGroup(
              layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
              .addGroup(layout.createSequentialGroup()
                  .addGap(11, 11, 11)
                  .addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, 57, javax.swing.GroupLayout.PREFERRED_SIZE)
                  .addGap(23, 23, 23)
                  .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                      .addComponent(jButton24, javax.swing.GroupLayout.PREFERRED_SIZE, 59, javax.swing.GroupLayout.PREFERRED_SIZE)
                      .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                          .addComponent(jButton28, javax.swing.GroupLayout.PREFERRED_SIZE, 59, javax.swing.GroupLayout.PREFERRED_SIZE)
                          .addComponent(jButton25, javax.swing.GroupLayout.PREFERRED_SIZE, 59, javax.swing.GroupLayout.PREFERRED_SIZE)
                          .addComponent(jButton27, javax.swing.GroupLayout.PREFERRED_SIZE, 59, javax.swing.GroupLayout.PREFERRED_SIZE)))
                  .addGap(6, 6, 6)
                  .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                      .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                          .addComponent(jButton15, javax.swing.GroupLayout.PREFERRED_SIZE, 59, javax.swing.GroupLayout.PREFERRED_SIZE)
                          .addComponent(jButton22, javax.swing.GroupLayout.PREFERRED_SIZE, 59, javax.swing.GroupLayout.PREFERRED_SIZE))
                      .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                          .addComponent(jButton16, javax.swing.GroupLayout.PREFERRED_SIZE, 59, javax.swing.GroupLayout.PREFERRED_SIZE)
                          .addComponent(jButton19, javax.swing.GroupLayout.PREFERRED_SIZE, 59, javax.swing.GroupLayout.PREFERRED_SIZE)))
                  .addGap(6, 6, 6)
                  .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                      .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                          .addComponent(jButton23, javax.swing.GroupLayout.PREFERRED_SIZE, 59, javax.swing.GroupLayout.PREFERRED_SIZE)
                          .addComponent(jButton13, javax.swing.GroupLayout.PREFERRED_SIZE, 59, javax.swing.GroupLayout.PREFERRED_SIZE))
                      .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                          .addComponent(jButton17, javax.swing.GroupLayout.PREFERRED_SIZE, 59, javax.swing.GroupLayout.PREFERRED_SIZE)
                          .addComponent(jButton20, javax.swing.GroupLayout.PREFERRED_SIZE, 59, javax.swing.GroupLayout.PREFERRED_SIZE)))
                  .addGap(6, 6, 6)
                  .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                      .addComponent(jButton18, javax.swing.GroupLayout.PREFERRED_SIZE, 59, javax.swing.GroupLayout.PREFERRED_SIZE)
                      .addComponent(jButton21, javax.swing.GroupLayout.PREFERRED_SIZE, 59, javax.swing.GroupLayout.PREFERRED_SIZE)
                      .addComponent(jButton26, javax.swing.GroupLayout.PREFERRED_SIZE, 59, javax.swing.GroupLayout.PREFERRED_SIZE)
                      .addComponent(jButton14, javax.swing.GroupLayout.PREFERRED_SIZE, 59, javax.swing.GroupLayout.PREFERRED_SIZE)))
          );
  
          pack();
      }// </editor-fold>//GEN-END:initComponents
  
      private void jTextField1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTextField1ActionPerformed
          // TODO add your handling code here:
      }//GEN-LAST:event_jTextField1ActionPerformed
  
      private void jButton24ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton24ActionPerformed
          
          if(eg==false){
          jTextField1.setText(jTextField1.getText()+"7");
         }else{
             jTextField1.setText("7");
             eg=false;
         }
      }//GEN-LAST:event_jButton24ActionPerformed
  
      private void jButton25ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton25ActionPerformed
          x=Double.parseDouble(jTextField1.getText());
          jTextField1.setText("");
          op="/";
      }//GEN-LAST:event_jButton25ActionPerformed
  
      private void jButton26ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton26ActionPerformed
         if(ver==false){
          jTextField1.setText(jTextField1.getText()+".");
         ver=true;
         }
      }//GEN-LAST:event_jButton26ActionPerformed
  
      private void jButton27ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton27ActionPerformed
          if(eg==false){
          jTextField1.setText(jTextField1.getText()+"8");
         }else{
             jTextField1.setText("8");
             eg=false;
         }
      }//GEN-LAST:event_jButton27ActionPerformed
  
      private void jButton28ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton28ActionPerformed
          if(eg==false){
          jTextField1.setText(jTextField1.getText()+"9");
         }else{
             jTextField1.setText("9");
             eg=false;
         }
      }//GEN-LAST:event_jButton28ActionPerformed
  
      private void jButton17ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton17ActionPerformed
  x=Double.parseDouble(jTextField1.getText());
          jTextField1.setText("");
          op="+";        
      }//GEN-LAST:event_jButton17ActionPerformed
  
      private void jButton18ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton18ActionPerformed
         
          x=Double.parseDouble(jTextField1.getText());
          jTextField1.setText("");
          op="-";
      }//GEN-LAST:event_jButton18ActionPerformed
  
      private void jButton20ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton20ActionPerformed
         if(eg==false){
          jTextField1.setText(jTextField1.getText()+"3");
         }else{
             jTextField1.setText("3");
             eg=false;
         }
      }//GEN-LAST:event_jButton20ActionPerformed
  
      private void jButton15ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton15ActionPerformed
          if(eg==false){
          jTextField1.setText(jTextField1.getText()+"4");
         }else{
             jTextField1.setText("4");
             eg=false;
         }
      }//GEN-LAST:event_jButton15ActionPerformed
  
      private void jButton22ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton22ActionPerformed
         if(eg==false){
          jTextField1.setText(jTextField1.getText()+"5");
         }else{
             jTextField1.setText("5");
             eg=false;
         }
      }//GEN-LAST:event_jButton22ActionPerformed
  
      private void jButton19ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton19ActionPerformed
          if(eg==false){
          jTextField1.setText(jTextField1.getText()+"6");
         }else{
             jTextField1.setText("6");
             eg=false;
         }
      }//GEN-LAST:event_jButton19ActionPerformed
  
      private void jButton13ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton13ActionPerformed
          if(eg==false){
          jTextField1.setText(jTextField1.getText()+"1");
         }else{
             jTextField1.setText("1");
             eg=false;
         }
      }//GEN-LAST:event_jButton13ActionPerformed
  
      private void jButton23ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton23ActionPerformed
          if(eg==false){
          jTextField1.setText(jTextField1.getText()+"2");
         }else{
             jTextField1.setText("2");
             eg=false;
         }
      }//GEN-LAST:event_jButton23ActionPerformed
  
      private void jButton14ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton14ActionPerformed
          if(eg==false){
          jTextField1.setText(jTextField1.getText()+"0");
         }else{
             jTextField1.setText("0");
             eg=false;
         }
      }//GEN-LAST:event_jButton14ActionPerformed
  
      private void jButton16ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton16ActionPerformed
          x=Double.parseDouble(jTextField1.getText());
          jTextField1.setText("");
          op="*";
      }//GEN-LAST:event_jButton16ActionPerformed
  
      private void jButton21ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton21ActionPerformed
          if(eg==false){
          y=Double.parseDouble(jTextField1.getText());
          if(op.equals("+"))
              jTextField1.setText(""+(x+y));
          if(op.equals("-"))
              jTextField1.setText(""+(x-y));
          if(op.equals("*"))
              jTextField1.setText(""+(x*y));
          if(op.equals("/")){
              if(y!=0){
              jTextField1.setText(""+(x+y));
              }else{
              jTextField1.setText("err");
              }
          }
          eg=true;
          }
      }//GEN-LAST:event_jButton21ActionPerformed
  
      /**
       * @param args the command line arguments
       */
      public static void main(String args[]) {
          /* Set the Nimbus look and feel */
          //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
          /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
           * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html 
           */
          try {
              for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                  if ("Nimbus".equals(info.getName())) {
                      javax.swing.UIManager.setLookAndFeel(info.getClassName());
                      break;
                  }
              }
          } catch (ClassNotFoundException ex) {
              java.util.logging.Logger.getLogger(calcuul.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
          } catch (InstantiationException ex) {
              java.util.logging.Logger.getLogger(calcuul.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
          } catch (IllegalAccessException ex) {
              java.util.logging.Logger.getLogger(calcuul.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
          } catch (javax.swing.UnsupportedLookAndFeelException ex) {
              java.util.logging.Logger.getLogger(calcuul.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
          }
          //</editor-fold>
  
          /* Create and display the form */
          java.awt.EventQueue.invokeLater(new Runnable() {
              public void run() {
                  new calcuul().setVisible(true);
              }
          });
      }
  
      // Variables declaration - do not modify//GEN-BEGIN:variables
      private javax.swing.JButton jButton13;
      private javax.swing.JButton jButton14;
      private javax.swing.JButton jButton15;
      private javax.swing.JButton jButton16;
      private javax.swing.JButton jButton17;
      private javax.swing.JButton jButton18;
      private javax.swing.JButton jButton19;
      private javax.swing.JButton jButton20;
      private javax.swing.JButton jButton21;
      private javax.swing.JButton jButton22;
      private javax.swing.JButton jButton23;
      private javax.swing.JButton jButton24;
      private javax.swing.JButton jButton25;
      private javax.swing.JButton jButton26;
      private javax.swing.JButton jButton27;
      private javax.swing.JButton jButton28;
      private javax.swing.JTextField jTextField1;
      // End of variables declaration//GEN-END:variables
  }