CalculadoraModerna/src/Classes/TelaCalculadora.java
/**
     * 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.
     */
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.
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")
    private void initComponents() {
        btnSom = new javax.swing.JButton();
        btnSub = new javax.swing.JButton();
        btnMul = new javax.swing.JButton();
        btnDiv = new javax.swing.JButton();
        val1 = new javax.swing.JSpinner();
        val2 = new javax.swing.JSpinner();
        jLabel1 = new javax.swing.JLabel();
        resultado = new javax.swing.JLabel();
        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        btnSom.setFont(new java.awt.Font("Tahoma", 0, 14)); 
        btnSom.setText("+");
        btnSom.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnSomActionPerformed(evt);
            }
        });
        btnSub.setFont(new java.awt.Font("Tahoma", 0, 14)); 
        btnSub.setText("-");
        btnSub.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnSubActionPerformed(evt);
            }
        });
        btnMul.setFont(new java.awt.Font("Tahoma", 0, 14)); 
        btnMul.setText("*");
        btnMul.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnMulActionPerformed(evt);
            }
        });
        btnDiv.setFont(new java.awt.Font("Tahoma", 0, 14)); 
        btnDiv.setText("/");
        btnDiv.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnDivActionPerformed(evt);
            }
        });
        val1.setFont(new java.awt.Font("Tahoma", 0, 18)); 
        val2.setFont(new java.awt.Font("Tahoma", 0, 18)); 
        jLabel1.setFont(new java.awt.Font("Tahoma", 0, 24)); 
        jLabel1.setText("=");
        resultado.setFont(new java.awt.Font("Tahoma", 0, 24)); 
        resultado.setText("0");
        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGap(36, 36, 36)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                    .addComponent(val1)
                    .addComponent(btnSom, javax.swing.GroupLayout.DEFAULT_SIZE, 50, Short.MAX_VALUE)
                    .addComponent(btnMul, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addGap(26, 26, 26)
                        .addComponent(val2, javax.swing.GroupLayout.PREFERRED_SIZE, 51, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(28, 28, 28)
                        .addComponent(jLabel1)
                        .addGap(33, 33, 33)
                        .addComponent(resultado))
                    .addGroup(layout.createSequentialGroup()
                        .addGap(18, 18, 18)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                            .addComponent(btnSub, javax.swing.GroupLayout.DEFAULT_SIZE, 50, Short.MAX_VALUE)
                            .addComponent(btnDiv, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))))
                .addContainerGap(48, Short.MAX_VALUE))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                .addGap(42, 42, 42)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(val1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(val2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel1)
                    .addComponent(resultado))
                .addGap(26, 26, 26)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(btnSom)
                    .addComponent(btnSub))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(btnMul)
                    .addComponent(btnDiv))
                .addContainerGap(32, Short.MAX_VALUE))
        );
        pack();
    }
@ SuppressWarnings ( "unchecked" ) private void initComponents ( ) { btnSom = new javax . swing . JButton ( ) ; btnSub = new javax . swing . JButton ( ) ; btnMul = new javax . swing . JButton ( ) ; btnDiv = new javax . swing . JButton ( ) ; val1 = new javax . swing . JSpinner ( ) ; val2 = new javax . swing . JSpinner ( ) ; jLabel1 = new javax . swing . JLabel ( ) ; resultado = new javax . swing . JLabel ( ) ; setDefaultCloseOperation ( javax . swing . WindowConstants . EXIT_ON_CLOSE ) ; btnSom . setFont ( new java . awt . Font ( "Tahoma" , 0 , 14 ) ) ; btnSom . setText ( "+" ) ; btnSom . addActionListener ( new java . awt . event . ActionListener ( ) { public void actionPerformed ( java . awt . event . ActionEvent evt ) { btnSomActionPerformed ( evt ) ; } } ) ; btnSub . setFont ( new java . awt . Font ( "Tahoma" , 0 , 14 ) ) ; btnSub . setText ( "-" ) ; btnSub . addActionListener ( new java . awt . event . ActionListener ( ) { public void actionPerformed ( java . awt . event . ActionEvent evt ) { btnSubActionPerformed ( evt ) ; } } ) ; btnMul . setFont ( new java . awt . Font ( "Tahoma" , 0 , 14 ) ) ; btnMul . setText ( "*" ) ; btnMul . addActionListener ( new java . awt . event . ActionListener ( ) { public void actionPerformed ( java . awt . event . ActionEvent evt ) { btnMulActionPerformed ( evt ) ; } } ) ; btnDiv . setFont ( new java . awt . Font ( "Tahoma" , 0 , 14 ) ) ; btnDiv . setText ( "/" ) ; btnDiv . addActionListener ( new java . awt . event . ActionListener ( ) { public void actionPerformed ( java . awt . event . ActionEvent evt ) { btnDivActionPerformed ( evt ) ; } } ) ; val1 . setFont ( new java . awt . Font ( "Tahoma" , 0 , 18 ) ) ; val2 . setFont ( new java . awt . Font ( "Tahoma" , 0 , 18 ) ) ; jLabel1 . setFont ( new java . awt . Font ( "Tahoma" , 0 , 24 ) ) ; jLabel1 . setText ( "=" ) ; resultado . setFont ( new java . awt . Font ( "Tahoma" , 0 , 24 ) ) ; resultado . setText ( "0" ) ; javax . swing . GroupLayout layout = new javax . swing . GroupLayout ( getContentPane ( ) ) ; getContentPane ( ) . setLayout ( layout ) ; layout . setHorizontalGroup ( layout . createParallelGroup ( javax . swing . GroupLayout . Alignment . LEADING ) . addGroup ( layout . createSequentialGroup ( ) . addGap ( 36 , 36 , 36 ) . addGroup ( layout . createParallelGroup ( javax . swing . GroupLayout . Alignment . TRAILING , false ) . addComponent ( val1 ) . addComponent ( btnSom , javax . swing . GroupLayout . DEFAULT_SIZE , 50 , Short . MAX_VALUE ) . addComponent ( btnMul , javax . swing . GroupLayout . DEFAULT_SIZE , javax . swing . GroupLayout . DEFAULT_SIZE , Short . MAX_VALUE ) ) . addGroup ( layout . createParallelGroup ( javax . swing . GroupLayout . Alignment . LEADING ) . addGroup ( layout . createSequentialGroup ( ) . addGap ( 26 , 26 , 26 ) . addComponent ( val2 , javax . swing . GroupLayout . PREFERRED_SIZE , 51 , javax . swing . GroupLayout . PREFERRED_SIZE ) . addGap ( 28 , 28 , 28 ) . addComponent ( jLabel1 ) . addGap ( 33 , 33 , 33 ) . addComponent ( resultado ) ) . addGroup ( layout . createSequentialGroup ( ) . addGap ( 18 , 18 , 18 ) . addGroup ( layout . createParallelGroup ( javax . swing . GroupLayout . Alignment . LEADING , false ) . addComponent ( btnSub , javax . swing . GroupLayout . DEFAULT_SIZE , 50 , Short . MAX_VALUE ) . addComponent ( btnDiv , javax . swing . GroupLayout . DEFAULT_SIZE , javax . swing . GroupLayout . DEFAULT_SIZE , Short . MAX_VALUE ) ) ) ) . addContainerGap ( 48 , Short . MAX_VALUE ) ) ) ; layout . setVerticalGroup ( layout . createParallelGroup ( javax . swing . GroupLayout . Alignment . LEADING ) . addGroup ( javax . swing . GroupLayout . Alignment . TRAILING , layout . createSequentialGroup ( ) . addGap ( 42 , 42 , 42 ) . addGroup ( layout . createParallelGroup ( javax . swing . GroupLayout . Alignment . BASELINE ) . addComponent ( val1 , javax . swing . GroupLayout . PREFERRED_SIZE , javax . swing . GroupLayout . DEFAULT_SIZE , javax . swing . GroupLayout . PREFERRED_SIZE ) . addComponent ( val2 , javax . swing . GroupLayout . PREFERRED_SIZE , javax . swing . GroupLayout . DEFAULT_SIZE , javax . swing . GroupLayout . PREFERRED_SIZE ) . addComponent ( jLabel1 ) . addComponent ( resultado ) ) . addGap ( 26 , 26 , 26 ) . addGroup ( layout . createParallelGroup ( javax . swing . GroupLayout . Alignment . BASELINE ) . addComponent ( btnSom ) . addComponent ( btnSub ) ) . addPreferredGap ( javax . swing . LayoutStyle . ComponentPlacement . UNRELATED ) . addGroup ( layout . createParallelGroup ( javax . swing . GroupLayout . Alignment . BASELINE ) . addComponent ( btnMul ) . addComponent ( btnDiv ) ) . addContainerGap ( 32 , Short . MAX_VALUE ) ) ) ; pack ( ) ; }
This method is called from within the constructor to initialize the form.
This method is called from within the constructor to initialize the form .
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents // NOI18N // NOI18N // NOI18N // NOI18N // NOI18N // NOI18N // NOI18N // NOI18N