idzik

Programowanie okienkowe/Java/Netbeans-Calculator-wersja-1

Jan 6th, 2016
353
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 23.76 KB | None | 0 0
  1. /*
  2.  * To change this license header, choose License Headers in Project Properties.
  3.  * To change this template file, choose Tools | Templates
  4.  * and open the template in the editor.
  5.  */
  6.  
  7. /**
  8.  *
  9.  * @author Tomasz
  10.  */
  11. public class Kalkulator extends javax.swing.JFrame {
  12.     private double pierwsza;
  13.     private double druga;
  14.     private double wynik;
  15.    
  16.     private boolean plus=false;
  17.     private boolean minus=false;
  18.     private boolean pomnoz=false;
  19.     private boolean podziel=false;
  20.     /**
  21.      * Creates new form Kalkulator
  22.      */
  23.     public Kalkulator() {
  24.         initComponents();
  25.     }
  26.  
  27.     /**
  28.      * This method is called from within the constructor to initialize the form.
  29.      * WARNING: Do NOT modify this code. The content of this method is always
  30.      * regenerated by the Form Editor.
  31.      */
  32.     @SuppressWarnings("unchecked")
  33.     // <editor-fold defaultstate="collapsed" desc="Generated Code">                          
  34.     private void initComponents() {
  35.  
  36.         jPanel1 = new javax.swing.JPanel();
  37.         przycisk7 = new javax.swing.JButton();
  38.         pole = new javax.swing.JTextField();
  39.         przycisk8 = new javax.swing.JButton();
  40.         przycisk9 = new javax.swing.JButton();
  41.         przyciskplus = new javax.swing.JButton();
  42.         przyciskczysc = new javax.swing.JButton();
  43.         przycisk4 = new javax.swing.JButton();
  44.         przycisk5 = new javax.swing.JButton();
  45.         przycisk6 = new javax.swing.JButton();
  46.         przyciskminus = new javax.swing.JButton();
  47.         przycisksilnia = new javax.swing.JButton();
  48.         przycisk1 = new javax.swing.JButton();
  49.         przycisk2 = new javax.swing.JButton();
  50.         przycisk3 = new javax.swing.JButton();
  51.         przyciskpomnoz = new javax.swing.JButton();
  52.         przyciskoblicz = new javax.swing.JButton();
  53.         przycisk0 = new javax.swing.JButton();
  54.         przyciskprzecinek = new javax.swing.JButton();
  55.         przyciskpodziel = new javax.swing.JButton();
  56.  
  57.         setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
  58.  
  59.         przycisk7.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
  60.         przycisk7.setText("7");
  61.         przycisk7.addActionListener(new java.awt.event.ActionListener() {
  62.             public void actionPerformed(java.awt.event.ActionEvent evt) {
  63.                 przycisk7ActionPerformed(evt);
  64.             }
  65.         });
  66.  
  67.         pole.setEditable(false);
  68.         pole.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
  69.         pole.setHorizontalAlignment(javax.swing.JTextField.RIGHT);
  70.         pole.setText("0");
  71.  
  72.         przycisk8.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
  73.         przycisk8.setText("8");
  74.         przycisk8.addActionListener(new java.awt.event.ActionListener() {
  75.             public void actionPerformed(java.awt.event.ActionEvent evt) {
  76.                 przycisk8ActionPerformed(evt);
  77.             }
  78.         });
  79.  
  80.         przycisk9.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
  81.         przycisk9.setText("9");
  82.         przycisk9.addActionListener(new java.awt.event.ActionListener() {
  83.             public void actionPerformed(java.awt.event.ActionEvent evt) {
  84.                 przycisk9ActionPerformed(evt);
  85.             }
  86.         });
  87.  
  88.         przyciskplus.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
  89.         przyciskplus.setText("+");
  90.         przyciskplus.addActionListener(new java.awt.event.ActionListener() {
  91.             public void actionPerformed(java.awt.event.ActionEvent evt) {
  92.                 przyciskplusActionPerformed(evt);
  93.             }
  94.         });
  95.  
  96.         przyciskczysc.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
  97.         przyciskczysc.setText("C");
  98.         przyciskczysc.addActionListener(new java.awt.event.ActionListener() {
  99.             public void actionPerformed(java.awt.event.ActionEvent evt) {
  100.                 przyciskczyscActionPerformed(evt);
  101.             }
  102.         });
  103.  
  104.         przycisk4.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
  105.         przycisk4.setText("4");
  106.         przycisk4.addActionListener(new java.awt.event.ActionListener() {
  107.             public void actionPerformed(java.awt.event.ActionEvent evt) {
  108.                 przycisk4ActionPerformed(evt);
  109.             }
  110.         });
  111.  
  112.         przycisk5.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
  113.         przycisk5.setText("5");
  114.         przycisk5.addActionListener(new java.awt.event.ActionListener() {
  115.             public void actionPerformed(java.awt.event.ActionEvent evt) {
  116.                 przycisk5ActionPerformed(evt);
  117.             }
  118.         });
  119.  
  120.         przycisk6.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
  121.         przycisk6.setText("6");
  122.         przycisk6.addActionListener(new java.awt.event.ActionListener() {
  123.             public void actionPerformed(java.awt.event.ActionEvent evt) {
  124.                 przycisk6ActionPerformed(evt);
  125.             }
  126.         });
  127.  
  128.         przyciskminus.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
  129.         przyciskminus.setText("-");
  130.  
  131.         przycisksilnia.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
  132.         przycisksilnia.setText("!");
  133.  
  134.         przycisk1.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
  135.         przycisk1.setText("1");
  136.         przycisk1.addActionListener(new java.awt.event.ActionListener() {
  137.             public void actionPerformed(java.awt.event.ActionEvent evt) {
  138.                 przycisk1ActionPerformed(evt);
  139.             }
  140.         });
  141.  
  142.         przycisk2.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
  143.         przycisk2.setText("2");
  144.         przycisk2.addActionListener(new java.awt.event.ActionListener() {
  145.             public void actionPerformed(java.awt.event.ActionEvent evt) {
  146.                 przycisk2ActionPerformed(evt);
  147.             }
  148.         });
  149.  
  150.         przycisk3.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
  151.         przycisk3.setText("3");
  152.         przycisk3.addActionListener(new java.awt.event.ActionListener() {
  153.             public void actionPerformed(java.awt.event.ActionEvent evt) {
  154.                 przycisk3ActionPerformed(evt);
  155.             }
  156.         });
  157.  
  158.         przyciskpomnoz.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
  159.         przyciskpomnoz.setText("*");
  160.  
  161.         przyciskoblicz.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
  162.         przyciskoblicz.setText("=");
  163.         przyciskoblicz.addActionListener(new java.awt.event.ActionListener() {
  164.             public void actionPerformed(java.awt.event.ActionEvent evt) {
  165.                 przyciskobliczActionPerformed(evt);
  166.             }
  167.         });
  168.  
  169.         przycisk0.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
  170.         przycisk0.setText("0");
  171.         przycisk0.addActionListener(new java.awt.event.ActionListener() {
  172.             public void actionPerformed(java.awt.event.ActionEvent evt) {
  173.                 przycisk0ActionPerformed(evt);
  174.             }
  175.         });
  176.  
  177.         przyciskprzecinek.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
  178.         przyciskprzecinek.setText(",");
  179.  
  180.         przyciskpodziel.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
  181.         przyciskpodziel.setText("/");
  182.  
  183.         javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
  184.         jPanel1.setLayout(jPanel1Layout);
  185.         jPanel1Layout.setHorizontalGroup(
  186.             jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  187.             .addGroup(jPanel1Layout.createSequentialGroup()
  188.                 .addContainerGap()
  189.                 .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  190.                     .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
  191.                         .addComponent(pole)
  192.                         .addGroup(jPanel1Layout.createSequentialGroup()
  193.                             .addComponent(przycisk7, javax.swing.GroupLayout.PREFERRED_SIZE, 45, javax.swing.GroupLayout.PREFERRED_SIZE)
  194.                             .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
  195.                             .addComponent(przycisk8, javax.swing.GroupLayout.PREFERRED_SIZE, 45, javax.swing.GroupLayout.PREFERRED_SIZE)
  196.                             .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
  197.                             .addComponent(przycisk9, javax.swing.GroupLayout.PREFERRED_SIZE, 45, javax.swing.GroupLayout.PREFERRED_SIZE)
  198.                             .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
  199.                             .addComponent(przyciskplus, javax.swing.GroupLayout.PREFERRED_SIZE, 45, javax.swing.GroupLayout.PREFERRED_SIZE)
  200.                             .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
  201.                             .addComponent(przyciskczysc, javax.swing.GroupLayout.PREFERRED_SIZE, 45, javax.swing.GroupLayout.PREFERRED_SIZE)))
  202.                     .addGroup(jPanel1Layout.createSequentialGroup()
  203.                         .addComponent(przycisk4, javax.swing.GroupLayout.PREFERRED_SIZE, 45, javax.swing.GroupLayout.PREFERRED_SIZE)
  204.                         .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
  205.                         .addComponent(przycisk5, javax.swing.GroupLayout.PREFERRED_SIZE, 45, javax.swing.GroupLayout.PREFERRED_SIZE)
  206.                         .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
  207.                         .addComponent(przycisk6, javax.swing.GroupLayout.PREFERRED_SIZE, 45, javax.swing.GroupLayout.PREFERRED_SIZE)
  208.                         .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
  209.                         .addComponent(przyciskminus, javax.swing.GroupLayout.PREFERRED_SIZE, 45, javax.swing.GroupLayout.PREFERRED_SIZE)
  210.                         .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
  211.                         .addComponent(przycisksilnia, javax.swing.GroupLayout.PREFERRED_SIZE, 45, javax.swing.GroupLayout.PREFERRED_SIZE))
  212.                     .addGroup(jPanel1Layout.createSequentialGroup()
  213.                         .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  214.                             .addGroup(jPanel1Layout.createSequentialGroup()
  215.                                 .addComponent(przycisk1, javax.swing.GroupLayout.PREFERRED_SIZE, 45, javax.swing.GroupLayout.PREFERRED_SIZE)
  216.                                 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
  217.                                 .addComponent(przycisk2, javax.swing.GroupLayout.PREFERRED_SIZE, 45, javax.swing.GroupLayout.PREFERRED_SIZE)
  218.                                 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
  219.                                 .addComponent(przycisk3, javax.swing.GroupLayout.PREFERRED_SIZE, 45, javax.swing.GroupLayout.PREFERRED_SIZE)
  220.                                 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
  221.                                 .addComponent(przyciskpomnoz, javax.swing.GroupLayout.PREFERRED_SIZE, 45, javax.swing.GroupLayout.PREFERRED_SIZE))
  222.                             .addGroup(jPanel1Layout.createSequentialGroup()
  223.                                 .addComponent(przycisk0, javax.swing.GroupLayout.PREFERRED_SIZE, 96, javax.swing.GroupLayout.PREFERRED_SIZE)
  224.                                 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
  225.                                 .addComponent(przyciskprzecinek, javax.swing.GroupLayout.PREFERRED_SIZE, 45, javax.swing.GroupLayout.PREFERRED_SIZE)
  226.                                 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
  227.                                 .addComponent(przyciskpodziel, javax.swing.GroupLayout.PREFERRED_SIZE, 45, javax.swing.GroupLayout.PREFERRED_SIZE)))
  228.                         .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
  229.                         .addComponent(przyciskoblicz, javax.swing.GroupLayout.PREFERRED_SIZE, 45, javax.swing.GroupLayout.PREFERRED_SIZE)))
  230.                 .addContainerGap(20, Short.MAX_VALUE))
  231.         );
  232.         jPanel1Layout.setVerticalGroup(
  233.             jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  234.             .addGroup(jPanel1Layout.createSequentialGroup()
  235.                 .addGap(21, 21, 21)
  236.                 .addComponent(pole, javax.swing.GroupLayout.PREFERRED_SIZE, 42, javax.swing.GroupLayout.PREFERRED_SIZE)
  237.                 .addGap(27, 27, 27)
  238.                 .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
  239.                     .addComponent(przycisk7, javax.swing.GroupLayout.PREFERRED_SIZE, 45, javax.swing.GroupLayout.PREFERRED_SIZE)
  240.                     .addComponent(przycisk8, javax.swing.GroupLayout.PREFERRED_SIZE, 45, javax.swing.GroupLayout.PREFERRED_SIZE)
  241.                     .addComponent(przycisk9, javax.swing.GroupLayout.PREFERRED_SIZE, 45, javax.swing.GroupLayout.PREFERRED_SIZE)
  242.                     .addComponent(przyciskplus, javax.swing.GroupLayout.PREFERRED_SIZE, 45, javax.swing.GroupLayout.PREFERRED_SIZE)
  243.                     .addComponent(przyciskczysc, javax.swing.GroupLayout.PREFERRED_SIZE, 45, javax.swing.GroupLayout.PREFERRED_SIZE))
  244.                 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
  245.                 .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
  246.                     .addComponent(przycisk4, javax.swing.GroupLayout.PREFERRED_SIZE, 45, javax.swing.GroupLayout.PREFERRED_SIZE)
  247.                     .addComponent(przycisk5, javax.swing.GroupLayout.PREFERRED_SIZE, 45, javax.swing.GroupLayout.PREFERRED_SIZE)
  248.                     .addComponent(przycisk6, javax.swing.GroupLayout.PREFERRED_SIZE, 45, javax.swing.GroupLayout.PREFERRED_SIZE)
  249.                     .addComponent(przyciskminus, javax.swing.GroupLayout.PREFERRED_SIZE, 45, javax.swing.GroupLayout.PREFERRED_SIZE)
  250.                     .addComponent(przycisksilnia, javax.swing.GroupLayout.PREFERRED_SIZE, 45, javax.swing.GroupLayout.PREFERRED_SIZE))
  251.                 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
  252.                 .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  253.                     .addGroup(jPanel1Layout.createSequentialGroup()
  254.                         .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
  255.                             .addComponent(przycisk1, javax.swing.GroupLayout.PREFERRED_SIZE, 45, javax.swing.GroupLayout.PREFERRED_SIZE)
  256.                             .addComponent(przycisk2, javax.swing.GroupLayout.PREFERRED_SIZE, 45, javax.swing.GroupLayout.PREFERRED_SIZE)
  257.                             .addComponent(przycisk3, javax.swing.GroupLayout.PREFERRED_SIZE, 45, javax.swing.GroupLayout.PREFERRED_SIZE)
  258.                             .addComponent(przyciskpomnoz, javax.swing.GroupLayout.PREFERRED_SIZE, 45, javax.swing.GroupLayout.PREFERRED_SIZE))
  259.                         .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
  260.                         .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
  261.                             .addComponent(przycisk0, javax.swing.GroupLayout.PREFERRED_SIZE, 45, javax.swing.GroupLayout.PREFERRED_SIZE)
  262.                             .addComponent(przyciskprzecinek, javax.swing.GroupLayout.PREFERRED_SIZE, 45, javax.swing.GroupLayout.PREFERRED_SIZE)
  263.                             .addComponent(przyciskpodziel, javax.swing.GroupLayout.PREFERRED_SIZE, 45, javax.swing.GroupLayout.PREFERRED_SIZE))
  264.                         .addGap(0, 0, Short.MAX_VALUE))
  265.                     .addComponent(przyciskoblicz, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
  266.                 .addContainerGap())
  267.         );
  268.  
  269.         javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
  270.         getContentPane().setLayout(layout);
  271.         layout.setHorizontalGroup(
  272.             layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  273.             .addGroup(layout.createSequentialGroup()
  274.                 .addContainerGap()
  275.                 .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
  276.                 .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
  277.         );
  278.         layout.setVerticalGroup(
  279.             layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  280.             .addGroup(layout.createSequentialGroup()
  281.                 .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
  282.                 .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
  283.         );
  284.  
  285.         pack();
  286.     }// </editor-fold>                        
  287.  
  288.     private void przycisk7ActionPerformed(java.awt.event.ActionEvent evt) {                                          
  289.        if (pole.getText().equals("0")){
  290.            pole.setText(przycisk7.getText());
  291.        }
  292.        else pole.setText(pole.getText()+przycisk7.getText());
  293.     }                                        
  294.  
  295.     private void przycisk8ActionPerformed(java.awt.event.ActionEvent evt) {                                          
  296.          if (pole.getText().equals("0")){
  297.            pole.setText(przycisk8.getText());
  298.        }
  299.        else pole.setText(pole.getText()+przycisk8.getText());
  300.     }                                        
  301.  
  302.     private void przycisk9ActionPerformed(java.awt.event.ActionEvent evt) {                                          
  303.          if (pole.getText().equals("0")){
  304.            pole.setText(przycisk9.getText());
  305.        }
  306.        else pole.setText(pole.getText()+przycisk9.getText());
  307.     }                                        
  308.  
  309.     private void przycisk4ActionPerformed(java.awt.event.ActionEvent evt) {                                          
  310.          if (pole.getText().equals("0")){
  311.            pole.setText(przycisk4.getText());
  312.        }
  313.        else pole.setText(pole.getText()+przycisk4.getText());
  314.     }                                        
  315.  
  316.     private void przycisk5ActionPerformed(java.awt.event.ActionEvent evt) {                                          
  317.          if (pole.getText().equals("0")){
  318.            pole.setText(przycisk5.getText());
  319.        }
  320.        else pole.setText(pole.getText()+przycisk5.getText());
  321.     }                                        
  322.  
  323.     private void przycisk6ActionPerformed(java.awt.event.ActionEvent evt) {                                          
  324.          if (pole.getText().equals("0")){
  325.            pole.setText(przycisk6.getText());
  326.        }
  327.        else pole.setText(pole.getText()+przycisk6.getText());
  328.     }                                        
  329.  
  330.     private void przycisk1ActionPerformed(java.awt.event.ActionEvent evt) {                                          
  331.          if (pole.getText().equals("0")){
  332.            pole.setText(przycisk1.getText());
  333.        }
  334.        else pole.setText(pole.getText()+przycisk1.getText());
  335.     }                                        
  336.  
  337.     private void przycisk2ActionPerformed(java.awt.event.ActionEvent evt) {                                          
  338.          if (pole.getText().equals("0")){
  339.            pole.setText(przycisk2.getText());
  340.        }
  341.        else pole.setText(pole.getText()+przycisk2.getText());
  342.     }                                        
  343.  
  344.     private void przycisk3ActionPerformed(java.awt.event.ActionEvent evt) {                                          
  345.          if (pole.getText().equals("0")){
  346.            pole.setText(przycisk3.getText());
  347.        }
  348.        else pole.setText(pole.getText()+przycisk3.getText());
  349.     }                                        
  350.  
  351.     private void przycisk0ActionPerformed(java.awt.event.ActionEvent evt) {                                          
  352.         if (pole.getText().equals("0")){
  353.            pole.setText(przycisk0.getText());
  354.        }
  355.        else pole.setText(pole.getText()+przycisk0.getText());
  356.     }                                        
  357.  
  358.     private void przyciskczyscActionPerformed(java.awt.event.ActionEvent evt) {                                              
  359.         pole.setText("0");
  360.     }                                            
  361.  
  362.     private void przyciskplusActionPerformed(java.awt.event.ActionEvent evt) {                                            
  363.         pierwsza=Double.parseDouble(pole.getText());
  364.         plus=true;
  365.         pole.setText("0");
  366.     }                                            
  367.  
  368.     private void przyciskobliczActionPerformed(java.awt.event.ActionEvent evt) {                                              
  369.         druga=Double.parseDouble(pole.getText());
  370.         plus=false;
  371.         wynik=pierwsza+druga;
  372.         pole.setText(String.valueOf(wynik));
  373.         //po zakończeniu działania
  374.         pierwsza=0;
  375.         druga=0;
  376.         wynik=0;
  377.     }                                              
  378.  
  379.     /**
  380.      * @param args the command line arguments
  381.      */
  382.     public static void main(String args[]) {
  383.         /* Set the Nimbus look and feel */
  384.         //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
  385.         /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
  386.          * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
  387.          */
  388.         try {
  389.             for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
  390.                 if ("Nimbus".equals(info.getName())) {
  391.                     javax.swing.UIManager.setLookAndFeel(info.getClassName());
  392.                     break;
  393.                 }
  394.             }
  395.         } catch (ClassNotFoundException ex) {
  396.             java.util.logging.Logger.getLogger(Kalkulator.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
  397.         } catch (InstantiationException ex) {
  398.             java.util.logging.Logger.getLogger(Kalkulator.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
  399.         } catch (IllegalAccessException ex) {
  400.             java.util.logging.Logger.getLogger(Kalkulator.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
  401.         } catch (javax.swing.UnsupportedLookAndFeelException ex) {
  402.             java.util.logging.Logger.getLogger(Kalkulator.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
  403.         }
  404.         //</editor-fold>
  405.  
  406.         /* Create and display the form */
  407.         java.awt.EventQueue.invokeLater(new Runnable() {
  408.             public void run() {
  409.                 new Kalkulator().setVisible(true);
  410.             }
  411.         });
  412.     }
  413.  
  414.     // Variables declaration - do not modify                    
  415.     private javax.swing.JPanel jPanel1;
  416.     private javax.swing.JTextField pole;
  417.     private javax.swing.JButton przycisk0;
  418.     private javax.swing.JButton przycisk1;
  419.     private javax.swing.JButton przycisk2;
  420.     private javax.swing.JButton przycisk3;
  421.     private javax.swing.JButton przycisk4;
  422.     private javax.swing.JButton przycisk5;
  423.     private javax.swing.JButton przycisk6;
  424.     private javax.swing.JButton przycisk7;
  425.     private javax.swing.JButton przycisk8;
  426.     private javax.swing.JButton przycisk9;
  427.     private javax.swing.JButton przyciskczysc;
  428.     private javax.swing.JButton przyciskminus;
  429.     private javax.swing.JButton przyciskoblicz;
  430.     private javax.swing.JButton przyciskplus;
  431.     private javax.swing.JButton przyciskpodziel;
  432.     private javax.swing.JButton przyciskpomnoz;
  433.     private javax.swing.JButton przyciskprzecinek;
  434.     private javax.swing.JButton przycisksilnia;
  435.     // End of variables declaration                  
  436. }
Advertisement
Add Comment
Please, Sign In to add comment