Calculadora en java

Solo disponible en BuenasTareas
  • Páginas : 9 (2102 palabras )
  • Descarga(s) : 0
  • Publicado : 25 de noviembre de 2010
Leer documento completo
Vista previa del texto
public class JFCalculadora extends javax.swing.JFrame {
private javax.swing.JTextField autor;
private javax.swing.JButton b1;
private javax.swing.JButton b2;
private javax.swing.JButton b3;
private javax.swing.JButton b4;
private javax.swing.JButton b5;
private javax.swing.JButton b6;
private javax.swing.JButton b7;
private javax.swing.JButton b8;private javax.swing.JButton b9;
private javax.swing.JButton bin;
private javax.swing.JButton borrar;
private javax.swing.JButton cero;
private javax.swing.JButton div;
private javax.swing.JButton hexa;
private javax.swing.JButton igual;
private javax.swing.JLabel jLabel1;
private javax.swing.JButton mmas;
private javax.swing.JButton mmen;private javax.swing.JButton mul;
private javax.swing.JTextField pantalla;
private javax.swing.JButton punto;
private javax.swing.JButton recme;
private javax.swing.JButton res;
private javax.swing.JButton sum;
float resultado;
float valorant;
float tipooper;//1.-suma,2.-resta,3.-mul,4.-div
int numero;
String mem;
/** Creates new formJFCalculadora */
public JFCalculadora() {
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")
//
private void initComponents() {jLabel1 = new javax.swing.JLabel();
pantalla = new javax.swing.JTextField();
b7 = new javax.swing.JButton();
b8 = new javax.swing.JButton();
b9 = new javax.swing.JButton();
b4 = new javax.swing.JButton();
b5 = new javax.swing.JButton();
b6 = new javax.swing.JButton();
b1 = new javax.swing.JButton();
b2 =new javax.swing.JButton();
b3 = new javax.swing.JButton();
cero = new javax.swing.JButton();
punto = new javax.swing.JButton();
sum = new javax.swing.JButton();
igual = new javax.swing.JButton();
div = new javax.swing.JButton();
mul = new javax.swing.JButton();
res = new javax.swing.JButton();
borrar = newjavax.swing.JButton();
hexa = new javax.swing.JButton();
bin = new javax.swing.JButton();
mmas = new javax.swing.JButton();
mmen = new javax.swing.JButton();
autor = new javax.swing.JTextField();
recme = new javax.swing.JButton();

setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

jLabel1.setFont(newjava.awt.Font("Old English Text MT", 0, 36));
jLabel1.setText("Calculadora");

pantalla.setFont(new java.awt.Font("Arial Black", 0, 24));
pantalla.setForeground(new java.awt.Color(0, 153, 153));

b7.setFont(new java.awt.Font("Tahoma", 0, 24));
b7.setText("7");
b7.addActionListener(new java.awt.event.ActionListener() {
public voidactionPerformed(java.awt.event.ActionEvent evt) {
b7ActionPerformed(evt);
}
});

b8.setFont(new java.awt.Font("Tahoma", 0, 24));
b8.setText("8");
b8.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
b8ActionPerformed(evt);
}});

b9.setFont(new java.awt.Font("Tahoma", 0, 24));
b9.setText("9");
b9.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
b9ActionPerformed(evt);
}
});

b4.setFont(new java.awt.Font("Tahoma", 0, 24));
b4.setText("4");...
tracking img