/* * To change this template, choose Tools | Templates * and open the template in the editor. *//* * Calculadora.java * * Created on 27/08/2012, 19:57:14 */package calculadora;import javax.swing.JOptionPane;/** * * @author mapsilva */public class Calculadora extends javax.swing.JFrame { private double memoria = 0; private String tela; private int oper = 0; private boolean limpa; /** Creates new form Calculadora */ public Calculadora() { initComponents(); } /** 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() { display = new javax.swing.JTextField(); limpar = new javax.swing.JButton(); um = new javax.swing.JButton(); dois = new javax.swing.JButton(); tres = new javax.swing.JButton(); quatro = new javax.swing.JButton(); cinco = new javax.swing.JButton(); seis = new javax.swing.JButton(); sete = new javax.swing.JButton(); oito = new javax.swing.JButton(); nove = new javax.swing.JButton(); zero = new javax.swing.JButton(); soma = new javax.swing.JButton(); subtrai = new javax.swing.JButton(); mult = new javax.swing.JButton(); divide = new javax.swing.JButton(); igual = new javax.swing.JButton(); jButton1 = new javax.swing.JButton(); raiz = new javax.swing.JButton(); seno = new javax.swing.JButton(); cosceno = new javax.swing.JButton(); tangente = new javax.swing.JButton(); fatorial = new javax.swing.JButton(); jMenuBar1 = new javax.swing.JMenuBar(); jMenu1 = new javax.swing.JMenu(); jMenuItem1 = new javax.swing.JMenuItem(); jMenu2 = new javax.swing.JMenu(); jMenuItem3 = new javax.swing.JMenuItem(); jMenuItem4 = new javax.swing.JMenuItem(); jMenuItem5 = new javax.swing.JMenuItem(); jMenu3 = new javax.swing.JMenu(); jMenuItem2 = new javax.swing.JMenuItem(); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); setResizable(false); display.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { displayActionPerformed(evt); } }); limpar.setText("Limpar"); limpar.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { limparActionPerformed(evt); } }); um.setText("1"); um.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { umActionPerformed(evt); } }); dois.setText("2"); dois.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { doisActionPerformed(evt); } }); tres.setText("3"); tres.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { tresActionPerformed(evt); } }); quatro.setText("4"); quatro.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { quatroActionPerformed(evt); } }); cinco.setText("5"); cinco.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { cincoActionPerformed(evt); } }); seis.setText("6"); seis.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { seisActionPerformed(evt); } }); sete.setText("7"); sete.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { seteActionPerformed(evt); } }); oito.setText("8"); oito.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { oitoActionPerformed(evt); } }); nove.setText("9"); nove.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { noveActionPerformed(evt); } }); zero.setText("0"); zero.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { zeroActionPerformed(evt); } }); soma.setText("+"); soma.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { somaActionPerformed(evt); } }); soma.addKeyListener(new java.awt.event.KeyAdapter() { public void keyPressed(java.awt.event.KeyEvent evt) { somaKeyPressed(evt); } }); subtrai.setText("-"); subtrai.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { subtraiActionPerformed(evt); } }); mult.setText("*"); mult.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { multActionPerformed(evt); } }); divide.setText("/"); divide.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { divideActionPerformed(evt); } }); igual.setText("="); igual.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { igualActionPerformed(evt); } }); jButton1.setText("+/-"); jButton1.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton1ActionPerformed(evt); } }); raiz.setText("raiz quadrada"); raiz.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { raizActionPerformed(evt); } }); seno.setText("seno"); seno.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { senoActionPerformed(evt); } }); cosceno.setText("cosceno"); cosceno.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { coscenoActionPerformed(evt); } }); tangente.setText("tangente"); tangente.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent