Advertisement
casparcedro

Calcprogress

Jan 28th, 2013
42
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 24.64 KB | None | 0 0
  1. /*
  2.  * To change this template, choose Tools | Templates
  3.  * and open the template in the editor.
  4.  */
  5. package GUI;
  6.  
  7. import java.util.Scanner;
  8.  
  9. /**
  10.  *
  11.  * @author Caspar Cedro
  12.  */
  13. public class CalculatorGUI extends javax.swing.JFrame {
  14. Integer firstDouble = null;
  15. Integer secondDouble = null;
  16. public void operation (String operator){
  17.     double resultant = firstDouble + operator + secondDouble ;
  18. }
  19. //Integer operator = null;
  20.     /*
  21.     //Variables
  22.     double plusminus;
  23.     double firstDouble;
  24.     double secondDouble;
  25.     double totalDouble;
  26.     //To check for button click
  27.     int plusClick;
  28.     int minusClick;
  29.     int multiplyClick;
  30.     int divideClick;
  31. */
  32.     /**
  33.      * Creates new form CalculatorGUI
  34.      */
  35.     public CalculatorGUI() {
  36.         initComponents();
  37.         //Insert code to operate calculator display here!
  38.         //result.setText("test");
  39.         //result.setText("");
  40.         //Scanner input = new Scanner(System.in);
  41.         result.setText("");
  42.         //int answer = input.nextInt();
  43.         /*if (input.hasNextInt()){
  44.         result.setText("("+input+")");
  45.             /*if (answer >= 0){
  46.             result.setText("("+answer+")");
  47.         } else {
  48.             result.setText("");
  49.         }*/
  50.         //result.setText("("+answer+")");
  51.         /*if (input.hasNextInt()) {
  52.            result.setText("(" + input.nextInt() + ")");
  53.         } else {
  54.             result.setText("");
  55.         }
  56.         } else {
  57.             result.setText("");
  58.         }*/
  59.     }
  60.  
  61.     /**
  62.      * 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.
  63.      */
  64.     @SuppressWarnings("unchecked")
  65.     // <editor-fold defaultstate="collapsed" desc="Generated Code">                          
  66.     private void initComponents() {
  67.  
  68.         division = new javax.swing.JButton();
  69.         one = new javax.swing.JButton();
  70.         four = new javax.swing.JButton();
  71.         seven = new javax.swing.JButton();
  72.         multiplication = new javax.swing.JButton();
  73.         two = new javax.swing.JButton();
  74.         five = new javax.swing.JButton();
  75.         eight = new javax.swing.JButton();
  76.         addition = new javax.swing.JButton();
  77.         three = new javax.swing.JButton();
  78.         six = new javax.swing.JButton();
  79.         nine = new javax.swing.JButton();
  80.         subtraction = new javax.swing.JButton();
  81.         zero = new javax.swing.JButton();
  82.         equals = new javax.swing.JButton();
  83.         decimal = new javax.swing.JButton();
  84.         clear = new javax.swing.JButton();
  85.         clearAll = new javax.swing.JButton();
  86.         result = new javax.swing.JFormattedTextField();
  87.  
  88.         setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
  89.  
  90.         division.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N
  91.         division.setText("รท");
  92.         division.setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));
  93.         division.addActionListener(new java.awt.event.ActionListener() {
  94.             public void actionPerformed(java.awt.event.ActionEvent evt) {
  95.                 divisionActionPerformed(evt);
  96.             }
  97.         });
  98.  
  99.         one.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N
  100.         one.setText("1");
  101.         one.addActionListener(new java.awt.event.ActionListener() {
  102.             public void actionPerformed(java.awt.event.ActionEvent evt) {
  103.                 oneActionPerformed(evt);
  104.             }
  105.         });
  106.  
  107.         four.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N
  108.         four.setText("4");
  109.         four.addActionListener(new java.awt.event.ActionListener() {
  110.             public void actionPerformed(java.awt.event.ActionEvent evt) {
  111.                 fourActionPerformed(evt);
  112.             }
  113.         });
  114.  
  115.         seven.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N
  116.         seven.setText("7");
  117.         seven.setToolTipText("");
  118.         seven.addActionListener(new java.awt.event.ActionListener() {
  119.             public void actionPerformed(java.awt.event.ActionEvent evt) {
  120.                 sevenActionPerformed(evt);
  121.             }
  122.         });
  123.  
  124.         multiplication.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N
  125.         multiplication.setText("x");
  126.         multiplication.addActionListener(new java.awt.event.ActionListener() {
  127.             public void actionPerformed(java.awt.event.ActionEvent evt) {
  128.                 multiplicationActionPerformed(evt);
  129.             }
  130.         });
  131.  
  132.         two.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N
  133.         two.setText("2");
  134.         two.addActionListener(new java.awt.event.ActionListener() {
  135.             public void actionPerformed(java.awt.event.ActionEvent evt) {
  136.                 twoActionPerformed(evt);
  137.             }
  138.         });
  139.  
  140.         five.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N
  141.         five.setText("5");
  142.         five.addActionListener(new java.awt.event.ActionListener() {
  143.             public void actionPerformed(java.awt.event.ActionEvent evt) {
  144.                 fiveActionPerformed(evt);
  145.             }
  146.         });
  147.  
  148.         eight.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N
  149.         eight.setText("8");
  150.         eight.addActionListener(new java.awt.event.ActionListener() {
  151.             public void actionPerformed(java.awt.event.ActionEvent evt) {
  152.                 eightActionPerformed(evt);
  153.             }
  154.         });
  155.  
  156.         addition.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N
  157.         addition.setText("+");
  158.         addition.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
  159.         addition.addActionListener(new java.awt.event.ActionListener() {
  160.             public void actionPerformed(java.awt.event.ActionEvent evt) {
  161.                 additionActionPerformed(evt);
  162.             }
  163.         });
  164.  
  165.         three.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N
  166.         three.setText("3");
  167.         three.addActionListener(new java.awt.event.ActionListener() {
  168.             public void actionPerformed(java.awt.event.ActionEvent evt) {
  169.                 threeActionPerformed(evt);
  170.             }
  171.         });
  172.  
  173.         six.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N
  174.         six.setText("6");
  175.         six.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
  176.         six.addActionListener(new java.awt.event.ActionListener() {
  177.             public void actionPerformed(java.awt.event.ActionEvent evt) {
  178.                 sixActionPerformed(evt);
  179.             }
  180.         });
  181.  
  182.         nine.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N
  183.         nine.setText("9");
  184.         nine.addActionListener(new java.awt.event.ActionListener() {
  185.             public void actionPerformed(java.awt.event.ActionEvent evt) {
  186.                 nineActionPerformed(evt);
  187.             }
  188.         });
  189.  
  190.         subtraction.setFont(new java.awt.Font("Tahoma", 0, 36)); // NOI18N
  191.         subtraction.setText("-");
  192.         subtraction.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
  193.         subtraction.addActionListener(new java.awt.event.ActionListener() {
  194.             public void actionPerformed(java.awt.event.ActionEvent evt) {
  195.                 subtractionActionPerformed(evt);
  196.             }
  197.         });
  198.  
  199.         zero.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N
  200.         zero.setText("0");
  201.         zero.addActionListener(new java.awt.event.ActionListener() {
  202.             public void actionPerformed(java.awt.event.ActionEvent evt) {
  203.                 zeroActionPerformed(evt);
  204.             }
  205.         });
  206.  
  207.         equals.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N
  208.         equals.setText("=");
  209.         equals.addActionListener(new java.awt.event.ActionListener() {
  210.             public void actionPerformed(java.awt.event.ActionEvent evt) {
  211.                 equalsActionPerformed(evt);
  212.             }
  213.         });
  214.  
  215.         decimal.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N
  216.         decimal.setText(".");
  217.  
  218.         clear.setText("C");
  219.  
  220.         clearAll.setText("CA");
  221.         clearAll.addActionListener(new java.awt.event.ActionListener() {
  222.             public void actionPerformed(java.awt.event.ActionEvent evt) {
  223.                 clearAllActionPerformed(evt);
  224.             }
  225.         });
  226.  
  227.         result.addActionListener(new java.awt.event.ActionListener() {
  228.             public void actionPerformed(java.awt.event.ActionEvent evt) {
  229.                 resultActionPerformed(evt);
  230.             }
  231.         });
  232.  
  233.         javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
  234.         getContentPane().setLayout(layout);
  235.         layout.setHorizontalGroup(
  236.             layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  237.             .addGroup(layout.createSequentialGroup()
  238.                 .addContainerGap()
  239.                 .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  240.                     .addComponent(result)
  241.                     .addGroup(layout.createSequentialGroup()
  242.                         .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  243.                             .addGroup(layout.createSequentialGroup()
  244.                                 .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
  245.                                     .addComponent(one, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
  246.                                     .addComponent(four, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
  247.                                     .addComponent(seven, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
  248.                                     .addComponent(division))
  249.                                 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
  250.                                 .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
  251.                                     .addComponent(two, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
  252.                                     .addComponent(five, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
  253.                                     .addComponent(eight, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
  254.                                     .addComponent(multiplication, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
  255.                                     .addComponent(zero)))
  256.                             .addComponent(clear, javax.swing.GroupLayout.PREFERRED_SIZE, 98, javax.swing.GroupLayout.PREFERRED_SIZE))
  257.                         .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
  258.                         .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
  259.                             .addGroup(layout.createSequentialGroup()
  260.                                 .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
  261.                                     .addComponent(three, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
  262.                                     .addComponent(decimal, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
  263.                                     .addComponent(six, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
  264.                                     .addComponent(addition, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
  265.                                     .addComponent(nine, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
  266.                                 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
  267.                                 .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
  268.                                     .addComponent(subtraction, javax.swing.GroupLayout.DEFAULT_SIZE, 82, Short.MAX_VALUE)
  269.                                     .addComponent(equals, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
  270.                             .addComponent(clearAll, javax.swing.GroupLayout.PREFERRED_SIZE, 109, javax.swing.GroupLayout.PREFERRED_SIZE))
  271.                         .addGap(0, 0, Short.MAX_VALUE)))
  272.                 .addContainerGap())
  273.         );
  274.         layout.setVerticalGroup(
  275.             layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  276.             .addGroup(layout.createSequentialGroup()
  277.                 .addContainerGap()
  278.                 .addComponent(result, javax.swing.GroupLayout.PREFERRED_SIZE, 90, javax.swing.GroupLayout.PREFERRED_SIZE)
  279.                 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
  280.                 .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
  281.                     .addComponent(clear, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE)
  282.                     .addComponent(clearAll, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE))
  283.                 .addGap(8, 8, 8)
  284.                 .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  285.                     .addGroup(layout.createSequentialGroup()
  286.                         .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  287.                             .addGroup(layout.createSequentialGroup()
  288.                                 .addComponent(division, javax.swing.GroupLayout.PREFERRED_SIZE, 45, javax.swing.GroupLayout.PREFERRED_SIZE)
  289.                                 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
  290.                                 .addComponent(one, javax.swing.GroupLayout.PREFERRED_SIZE, 45, javax.swing.GroupLayout.PREFERRED_SIZE)
  291.                                 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
  292.                                 .addComponent(four, javax.swing.GroupLayout.PREFERRED_SIZE, 45, javax.swing.GroupLayout.PREFERRED_SIZE)
  293.                                 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
  294.                                 .addComponent(seven, javax.swing.GroupLayout.PREFERRED_SIZE, 45, javax.swing.GroupLayout.PREFERRED_SIZE))
  295.                             .addGroup(layout.createSequentialGroup()
  296.                                 .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
  297.                                     .addComponent(addition, javax.swing.GroupLayout.PREFERRED_SIZE, 45, javax.swing.GroupLayout.PREFERRED_SIZE)
  298.                                     .addComponent(subtraction, javax.swing.GroupLayout.PREFERRED_SIZE, 43, javax.swing.GroupLayout.PREFERRED_SIZE))
  299.                                 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
  300.                                 .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
  301.                                     .addComponent(equals, javax.swing.GroupLayout.PREFERRED_SIZE, 147, javax.swing.GroupLayout.PREFERRED_SIZE)
  302.                                     .addGroup(layout.createSequentialGroup()
  303.                                         .addComponent(three, javax.swing.GroupLayout.PREFERRED_SIZE, 45, javax.swing.GroupLayout.PREFERRED_SIZE)
  304.                                         .addGap(57, 57, 57)
  305.                                         .addComponent(nine, javax.swing.GroupLayout.PREFERRED_SIZE, 45, javax.swing.GroupLayout.PREFERRED_SIZE))))
  306.                             .addGroup(layout.createSequentialGroup()
  307.                                 .addGap(102, 102, 102)
  308.                                 .addComponent(six, javax.swing.GroupLayout.PREFERRED_SIZE, 45, javax.swing.GroupLayout.PREFERRED_SIZE)))
  309.                         .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
  310.                         .addComponent(decimal, javax.swing.GroupLayout.PREFERRED_SIZE, 45, javax.swing.GroupLayout.PREFERRED_SIZE))
  311.                     .addGroup(layout.createSequentialGroup()
  312.                         .addComponent(multiplication, javax.swing.GroupLayout.PREFERRED_SIZE, 45, javax.swing.GroupLayout.PREFERRED_SIZE)
  313.                         .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
  314.                         .addComponent(two, javax.swing.GroupLayout.PREFERRED_SIZE, 45, javax.swing.GroupLayout.PREFERRED_SIZE)
  315.                         .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
  316.                         .addComponent(five, javax.swing.GroupLayout.PREFERRED_SIZE, 45, javax.swing.GroupLayout.PREFERRED_SIZE)
  317.                         .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
  318.                         .addComponent(eight, javax.swing.GroupLayout.PREFERRED_SIZE, 45, javax.swing.GroupLayout.PREFERRED_SIZE)
  319.                         .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
  320.                         .addComponent(zero, javax.swing.GroupLayout.PREFERRED_SIZE, 45, javax.swing.GroupLayout.PREFERRED_SIZE)))
  321.                 .addContainerGap(12, Short.MAX_VALUE))
  322.         );
  323.  
  324.         pack();
  325.     }// </editor-fold>                        
  326.  
  327.     private void oneActionPerformed(java.awt.event.ActionEvent evt) {                                    
  328.         // TODO add your handling code here:
  329.        result.setText("1");
  330.        if(firstDouble == null){
  331.            firstDouble = 1;
  332.        }
  333.        
  334.  
  335.      
  336.        
  337.        
  338.         /* double yolo = Double.parseDouble(result.getText());
  339.      
  340.         //int number = Integer.parseInt(result.getText());
  341.         yolo++;
  342.         System.out.println(Double.parseDouble("1"));
  343.         result.setText(""+yolo+"");
  344.         //result.setText(""+1+"");*/
  345.     }                                  
  346.  
  347.     private void twoActionPerformed(java.awt.event.ActionEvent evt) {                                    
  348.         // TODO add your handling code here:
  349.         result.setText("2");
  350.     }                                  
  351.  
  352.     private void threeActionPerformed(java.awt.event.ActionEvent evt) {                                      
  353.         // TODO add your handling code here:
  354.         result.setText("3");
  355.     }                                    
  356.  
  357.     private void fourActionPerformed(java.awt.event.ActionEvent evt) {                                    
  358.         // TODO add your handling code here:
  359.         result.setText("4");
  360.     }                                    
  361.  
  362.     private void fiveActionPerformed(java.awt.event.ActionEvent evt) {                                    
  363.         // TODO add your handling code here:
  364.         result.setText("5");
  365.     }                                    
  366.  
  367.     private void sixActionPerformed(java.awt.event.ActionEvent evt) {                                    
  368.         // TODO add your handling code here:
  369.         result.setText("6");
  370.     }                                  
  371.  
  372.     private void sevenActionPerformed(java.awt.event.ActionEvent evt) {                                      
  373.         // TODO add your handling code here:
  374.         result.setText("7");
  375.     }                                    
  376.  
  377.     private void eightActionPerformed(java.awt.event.ActionEvent evt) {                                      
  378.         // TODO add your handling code here:
  379.         result.setText("8");
  380.     }                                    
  381.  
  382.     private void nineActionPerformed(java.awt.event.ActionEvent evt) {                                    
  383.         // TODO add your handling code here:
  384.         result.setText("9");
  385.     }                                    
  386.  
  387.     private void zeroActionPerformed(java.awt.event.ActionEvent evt) {                                    
  388.         // TODO add your handling code here:
  389.         result.setText("0");
  390.     }                                    
  391.  
  392.     private void clearAllActionPerformed(java.awt.event.ActionEvent evt) {                                        
  393.         // TODO add your handling code here:
  394.         result.setText("");
  395.         firstDouble = null;
  396.         secondDouble = null;
  397.     }                                        
  398.  
  399.     private void resultActionPerformed(java.awt.event.ActionEvent evt) {                                      
  400.         // TODO add your handling code here:
  401.        
  402.  
  403.  
  404.     }                                      
  405.  
  406.     private void divisionActionPerformed(java.awt.event.ActionEvent evt) {                                        
  407.         // TODO add your handling code here:
  408.         result.setText("/");
  409.        
  410.     }                                        
  411.  
  412.     private void multiplicationActionPerformed(java.awt.event.ActionEvent evt) {                                              
  413.         // TODO add your handling code here:
  414.     }                                              
  415.  
  416.     private void additionActionPerformed(java.awt.event.ActionEvent evt) {                                        
  417.         // TODO add your handling code here:
  418.     }                                        
  419.  
  420.     private void subtractionActionPerformed(java.awt.event.ActionEvent evt) {                                            
  421.         // TODO add your handling code here:
  422.     }                                          
  423.  
  424.     private void equalsActionPerformed(java.awt.event.ActionEvent evt) {                                      
  425.         // TODO add your handling code here:
  426.                 double answer = firstDouble + operator + secondDouble;
  427.         if(firstDouble != null){
  428.             if(operator != null){
  429.                 if(secondDouble != null){
  430.                  result.setText("(" + answer +")");
  431.             }
  432.             }
  433.         }
  434.     }                                      
  435.  
  436.     /**
  437.      * @param args the command line arguments
  438.      */
  439.     public static void main(String args[]) {
  440.         /* Set the Nimbus look and feel */
  441.         //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
  442.         /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
  443.          * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
  444.          */
  445.         try {
  446.             for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
  447.                 if ("Nimbus".equals(info.getName())) {
  448.                     javax.swing.UIManager.setLookAndFeel(info.getClassName());
  449.                     break;
  450.                 }
  451.             }
  452.         } catch (ClassNotFoundException ex) {
  453.             java.util.logging.Logger.getLogger(CalculatorGUI.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
  454.         } catch (InstantiationException ex) {
  455.             java.util.logging.Logger.getLogger(CalculatorGUI.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
  456.         } catch (IllegalAccessException ex) {
  457.             java.util.logging.Logger.getLogger(CalculatorGUI.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
  458.         } catch (javax.swing.UnsupportedLookAndFeelException ex) {
  459.             java.util.logging.Logger.getLogger(CalculatorGUI.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
  460.         }
  461.         //</editor-fold>
  462.  
  463.         /* Create and display the form */
  464.         java.awt.EventQueue.invokeLater(new Runnable() {
  465.             public void run() {
  466.                 new CalculatorGUI().setVisible(true);
  467.             }
  468.         });
  469.     }
  470.     // Variables declaration - do not modify                    
  471.     private javax.swing.JButton addition;
  472.     private javax.swing.JButton clear;
  473.     private javax.swing.JButton clearAll;
  474.     private javax.swing.JButton decimal;
  475.     private javax.swing.JButton division;
  476.     private javax.swing.JButton eight;
  477.     private javax.swing.JButton equals;
  478.     private javax.swing.JButton five;
  479.     private javax.swing.JButton four;
  480.     private javax.swing.JButton multiplication;
  481.     private javax.swing.JButton nine;
  482.     private javax.swing.JButton one;
  483.     private javax.swing.JFormattedTextField result;
  484.     private javax.swing.JButton seven;
  485.     private javax.swing.JButton six;
  486.     private javax.swing.JButton subtraction;
  487.     private javax.swing.JButton three;
  488.     private javax.swing.JButton two;
  489.     private javax.swing.JButton zero;
  490.     // End of variables declaration                  
  491. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement