COMO HACER CALCULADORA EN NETBEANS
Enviado por izaack27L • 1 de Diciembre de 2013 • 7.645 Palabras (31 Páginas) • 605 Visitas
import javax.swing.JButton;
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
/**
*
* @author PC-14
*/
public class calculadorass extends javax.swing.JFrame {
private JButton M;
private JButton N;
private JButton MUL;
private JButton IGU;
private JButton DIV;
String memoria1;
String signo;
String memoria2;
/**
* Creates new form calculadorass
*/
public calculadorass() {
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() {
jPanel1 = new javax.swing.JPanel();
NUM1 = new javax.swing.JButton();
NUM4 = new javax.swing.JButton();
NUM7 = new javax.swing.JButton();
PUNTO = new javax.swing.JButton();
NUM2 = new javax.swing.JButton();
NUM5 = new javax.swing.JButton();
NUM8 = new javax.swing.JButton();
NUM0 = new javax.swing.JButton();
NUM3 = new javax.swing.JButton();
NUM6 = new javax.swing.JButton();
NUM9 = new javax.swing.JButton();
IGUAL = new javax.swing.JButton();
MAS = new javax.swing.JButton();
MENOS = new javax.swing.JButton();
MULTI = new javax.swing.JButton();
DIVICION = new javax.swing.JButton();
MOSTRADOR = new javax.swing.JLabel();
CLEAR = new javax.swing.JButton();
C = new javax.swing.JButton();
BARRAMENU = new javax.swing.JMenuBar();
jMenu1 = new javax.swing.JMenu();
jMenuItem1 = new javax.swing.JMenuItem();
jMenu2 = new javax.swing.JMenu();
jMenuItem2 = new javax.swing.JMenuItem();
jMenu4 = new javax.swing.JMenu();
jMenuItem3 = new javax.swing.JMenuItem();
jMenu5 = new javax.swing.JMenu();
jMenuItem4 = new javax.swing.JMenuItem();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
NUM1.setBackground(new java.awt.Color(153, 153, 153));
NUM1.setForeground(new java.awt.Color(51, 51, 51));
NUM1.setText("1");
NUM1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
NUM1ActionPerformed(evt);
}
});
NUM4.setBackground(new java.awt.Color(153, 153, 153));
NUM4.setForeground(new java.awt.Color(51, 51, 51));
NUM4.setText("4");
NUM4.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
NUM4ActionPerformed(evt);
}
});
NUM7.setBackground(new java.awt.Color(153, 153, 153));
NUM7.setForeground(new java.awt.Color(51, 51, 51));
NUM7.setText("7");
NUM7.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
NUM7ActionPerformed(evt);
}
});
PUNTO.setBackground(new java.awt.Color(153, 153, 153));
PUNTO.setForeground(new java.awt.Color(51, 51, 51));
PUNTO.setText(".");
PUNTO.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
PUNTOActionPerformed(evt);
}
});
NUM2.setBackground(new java.awt.Color(153, 153, 153));
NUM2.setForeground(new java.awt.Color(51, 51, 51));
NUM2.setText("2");
NUM2.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
NUM2ActionPerformed(evt);
}
});
NUM5.setBackground(new java.awt.Color(153, 153, 153));
NUM5.setForeground(new java.awt.Color(51, 51, 51));
NUM5.setText("5");
NUM5.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
NUM5ActionPerformed(evt);
}
});
NUM8.setBackground(new java.awt.Color(153, 153, 153));
NUM8.setForeground(new java.awt.Color(51, 51, 51));
NUM8.setText("8");
NUM8.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
NUM8ActionPerformed(evt);
}
});
NUM0.setBackground(new java.awt.Color(153, 153, 153));
NUM0.setForeground(new java.awt.Color(51, 51, 51));
NUM0.setText("0");
NUM0.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
NUM0ActionPerformed(evt);
}
});
NUM3.setBackground(new java.awt.Color(153, 153, 153));
NUM3.setForeground(new java.awt.Color(51, 51, 51));
NUM3.setText("3");
NUM3.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
NUM3ActionPerformed(evt);
}
});
NUM6.setBackground(new java.awt.Color(153, 153, 153));
NUM6.setForeground(new java.awt.Color(51, 51, 51));
NUM6.setText("6");
...