Ventanas java

Páginas: 4 (792 palabras) Publicado: 1 de diciembre de 2011
Calculadora Aritmética.
Calculadora.
package gui1;
public class Calculadora_aritmetica {
public double suma(double dat_1,double dat_2){
return (dat_1+dat_2); }
public doubleresta(double dat_1,double dat_2){
return (dat_1-dat_2); }
public double multiplicacion(double dat_1,double dat_2){
return (dat_1*dat_2); }
public doubledivision(double dat_1,double dat_2){
if(dat_2==0)
System.out.println("Dato dos debe ser diferente de cero");
return (dat_1/dat_2); }
}
Ventana.
package gui1;
importjava.awt.*;
import javax.swing.*;
import java.awt.event.*;
public class Ventana extends JFrame {
private JLabel Lab1, Lab2;
private JTextField textF1, textF2, textF3, textF4,textF5,textF6;private JButton b1,b2,b3,b4;
private Panel p1,p2,p3,p4,p5;
public Ventana(){
super("Calculadora");
p1=new Panel();
Lab1=new JLabel("Ingresa numero");p1.add(Lab1);
textF1=new JTextField(10);
p1.add(textF1);
Lab2=new JLabel("Ingresa numero");
p1.add(Lab2);
textF2=new JTextField(10);
p1.add(textF2);p2=new Panel();
b1=new JButton("Suma");
p2.add(b1);
textF3=new JTextField(7);
textF3.setEditable(false);
p2.add(textF3);
p3=newPanel();
b2=new JButton("Resta");
p3.add(b2);
textF4=new JTextField(7);
textF4.setEditable(false);
p3.add(textF4);
p4=new Panel();
b3=newJButton("Multiplicacion");
p4.add(b3);
textF5=new JTextField(7);
textF5.setEditable(false);
p4.add(textF5);
p5=new Panel();
b4=newJButton("Division");
p5.add(b4);
textF6=new JTextField(7);
textF6.setEditable(false);
p5.add(textF6);
setSize(470,230);
setVisible(true);
setLayout(new...
Leer documento completo

Regístrate para leer el documento completo.

Estos documentos también te pueden resultar útiles

  • Manual para crear ventanas en java
  • Crear ventanas java
  • Swing Ventanas En Java
  • Crear VEntanas Internas En Java
  • La ventana
  • ventanas
  • La ventana
  • Ventanas

Conviértase en miembro formal de Buenas Tareas

INSCRÍBETE - ES GRATIS