Cerraura electronics

Páginas: 10 (2456 palabras) Publicado: 21 de noviembre de 2010
import java.awt.Color;
import java.awt.Font;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JOptionPane;
import javax.swing.JTextField;

public class calculadora extends JFrame implements ActionListener{
JButton suma, resta, division, multi, borrar, seno, coseno,tan,atan,senh,cosh,jbn0,jbn1,jbn2,jbn3,jbn4,jbn5,jbn6,jbn7,jbn8,jbn9;
JButton jbpunto,jbpi,jbxy,jbraiz,jbpotencia, jbfactorial,jblog,jbln,j,jbe,jbeuler;
JButton jbfraccion,jbigual,jbcubo,btnExpo,jbpotenciax;
JTextField jttexto;
boolean nuevo=true;
int contador=0;
char ultima='=';
double resultado=0;

public calculadora() {
setSize(550, 300);
setTitle("CALCULADORA CIENTIFICA");setDefaultCloseOperation(DISPOSE_ON_CLOSE);
setLocationRelativeTo(null);
getContentPane().setLayout(null);
getContentPane().setBackground(Color.green);
//implementacion delos botones
jttexto=new JTextField(" ");
jttexto.setBounds(50, 10, 300, 20);
getContentPane().add(jttexto);
jttexto.setFont(new Font("Arial",Font.BOLD,20));
jttexto.setHorizontalAlignment(jttexto.RIGHT); //posecion del textojttexto.addActionListener(this);
setResizable(false);

suma=new JButton("+");
suma.setBounds(480, 90, 50,20);
getContentPane().add(suma);
suma.setFont(new Font("Arial",Font.BOLD,20));
suma.addActionListener(this);

resta=new JButton("-");
resta.setBounds(480, 120, 50, 20);
getContentPane().add(resta);
resta.setFont(new Font("Arial",Font.BOLD,20));
resta.addActionListener(this);multi=new JButton("x");
multi.setBounds(480, 150, 50,20);
getContentPane().add(multi);
multi.setFont(new Font("Arial",Font.BOLD,20));
multi.addActionListener(this);

division=new JButton("/");
division.setBounds(480, 180, 50,20);
getContentPane().add(division);
division.setFont(new Font("Arial",Font.BOLD,20));
division.addActionListener(this);
//
jbigual=new JButton("=");jbigual.setBounds(420, 180, 50,20);
jbigual.setFont(new Font("Arial",Font.BOLD,20));
getContentPane().add(jbigual);
jbigual.addActionListener(this);
//
jbpunto=new JButton(".");
jbpunto.setBounds(360, 180, 50,20);
jbpunto.setFont(new Font("Arial",Font.BOLD,20));
getContentPane().add(jbpunto);
jbpunto.addActionListener(this);

jbn1=new JButton("1");
jbn1.setBounds(300,90,50,20);
getContentPane().add(jbn1);
jbn1.setFont(new Font("Arial",Font.BOLD,20));
jbn1.addActionListener(this);

jbn2=new JButton("2");
jbn2.setBounds(360, 90, 50,20);
getContentPane().add(jbn2);
jbn2.setFont(new Font("Arial",Font.BOLD,20));
jbn2.addActionListener(this);

jbn3=new JButton("3");
jbn3.setBounds(420, 90, 50, 20);
getContentPane().add(jbn3);
jbn3.setFont(newFont("Arial",Font.BOLD,20));
jbn3.addActionListener(this);

jbn4=new JButton("4");
jbn4.setBounds(300, 120, 50,20);
getContentPane().add(jbn4);
jbn4.setFont(new Font("Arial",Font.BOLD,20));
jbn4.addActionListener(this);

jbn5=new JButton("5");
jbn5.setBounds(360, 120, 50,20);
getContentPane().add(jbn5);
jbn5.setFont(new Font("Arial",Font.BOLD,20));jbn5.addActionListener(this);

jbn6=new JButton("6");
jbn6.setBounds(420, 120, 50,20);
getContentPane().add(jbn6);
jbn6.setFont(new Font("Arial",Font.BOLD,20));
jbn6.addActionListener(this);

jbn7=new JButton("7");
jbn7.setBounds(300, 150, 50,20);
getContentPane().add(jbn7);
jbn7.setFont(new Font("Arial",Font.BOLD,20));
jbn7.addActionListener(this);

jbn8=new JButton("8");jbn8.setBounds(360, 150, 50,20);
getContentPane().add(jbn8);
jbn8.setFont(new Font("Arial",Font.BOLD,20));
jbn8.addActionListener(this);

jbn9=new JButton("9");
jbn9.setBounds(420, 150, 50,20);
getContentPane().add(jbn9);
jbn9.setFont(new Font("Arial",Font.BOLD,20));
jbn9.addActionListener(this);


jbn0=new JButton("0");
jbn0.setBounds(300, 180, 50,20);
getContentPane().add(jbn0);...
Leer documento completo

Regístrate para leer el documento completo.

Estos documentos también te pueden resultar útiles

  • Electronics
  • Electronics
  • Beats Electronics
  • Pevey Electronics
  • empire electronics
  • Lg electronics
  • LG ELECTRONICS
  • tecnico en electronics

Conviértase en miembro formal de Buenas Tareas

INSCRÍBETE - ES GRATIS