Programa

Solo disponible en BuenasTareas
  • Páginas : 3 (698 palabras )
  • Descarga(s) : 0
  • Publicado : 4 de septiembre de 2010
Leer documento completo
Vista previa del texto
import java.io.*;
import java.awt.*;
import javax.swing.*;
import java.awt.event.*;
import java.util.Date;
import java.applet.Applet;

public class Calculadora extends Applet
{
TextFieldpantallita;
public final int ND = 0;
public final int SUMA = 1;
public final int RESTA = 2;
public final int MULT = 3;
public final int DIV = 4;
public final int IGUAL = 5;
public final intBORRAR_C = 6;
public final int BORRAR_AC = 7;
public final int PUNTO_DECIMAL = -1;

String cadDecimal;
int operador = ND;
boolean nuevoNumero = true;
boolean esDecimal = false;
double Total =0.0;
boolean esConstante = false;
double numConstante = 0.0;
int opConstante = ND;

public void calc() {
botononCalculadoraboton0,boton1,boton2,boton3,boton4,boton5,boton6,boton7,boton8,boton9, botonDecimal,botonSuma,botonResta,botonMult,botonDiv,botonIgual,botonBorraC,botonBorraAC;

setLayout( null );
setFont( new Font( "Comic Sans MS",Font.BOLD,14 ) );setBackground(Color.MAGENTA);

boton0 = new botononCalculadora( "0",ND,0 );
add( boton0 );
boton0.reshape( 8,144,96,24 );
boton1 = new botononCalculadora( "1",ND,1 );
add( boton1 );
boton1.reshape( 8,112,40,24 );boton2 = new botononCalculadora( "2",ND,2 );
add( boton2 );
boton2.reshape( 64,112,40,24 );
boton3 = new botononCalculadora( "3",ND,3 );
add( boton3 );
boton3.reshape( 120,112,40,24 );
boton4 = newbotononCalculadora( "4",ND,4 );
add( boton4 );
boton4.reshape( 8,80,40,24 );
boton5 = new botononCalculadora( "5",ND,5 );
add( boton5 );
boton5.reshape( 64,80,40,24 );
boton6 = newbotononCalculadora( "6",ND,6 );
add( boton6 );
boton6.reshape( 120,80,40,24 );
boton7 = new botononCalculadora( "7",ND,7 );
add( boton7 );
boton7.reshape( 8,48,40,24 );
boton8 = new botononCalculadora("8",ND,8 );
add( boton8 );
boton8.reshape( 64,48,40,24 );
boton9 = new botononCalculadora( "9",ND,9 );
add( boton9 );
boton9.reshape( 120,48,40,24 );

botonDecimal = new botononCalculadora(...
tracking img