Professional Documents
Culture Documents
Botonnes Java
Botonnes Java
import java.awt.*;
import java.util.Scanner;
import javax.swing.*;
import java.awt.Font;
class Datospersonales extends Frame
{ public Label
Tdoc,NoId,nom1,nom2,ape1,ape2,dir,tel,cel,eMa,eMi,sexo,mun,dep,titulo,titulo1;
public TextField TxtNoId, Txtnom1, Txtnom2, TxtApe1, TxtApe2, TxtDir,TxtTel,
TxtCel, TxteMa, TxteMi, TxtMun, TxtDep;
public CheckboxGroup Genero;
private List ListGenV,set2List,listaActiva,resultList;
public Checkbox chk1,chk2,chk3,chk4;
TextArea t1,t2;
Choice LtipDoc;
Button BtnLimp = new Button();
Button BtnMod =new Button();
//List ListGen,LtipDoc, Lbar;
public Datospersonales()
{ //titulo1 = new Label("GESTION Y SEGUIMIENTO DE APRENDICES",Label.CENTER);
/*titulo1 = new Label("GESTION Y SEGUIMIENTO APRE" ,Label.CENTER);
titulo1.setFont(new java.awt.Font("Tahoma",3,27));
titulo1.setForeground(Color.white);
titulo1.setBounds(5,60,620,20);
this.add(titulo1);*/
//crear objetos con el operador new:
Button BtnPri =new Button();Button BtnAnt =new Button();Button BtnSte
=new Button();
Button BtnUlt =new Button();Button BtnNue =new Button();Button BtnMod
=new Button();
Button BtnEli =new Button();Button BtnRen =new Button();Button BtnBus
=new Button();
Button BtnExp =new Button();Button BtnImp =new Button();Button BtnCan
=new Button();
Button BtnSal =new Button();
//Button BtnLimp =new Button();
/*Genero=new CheckboxGroup();
chk1=new Checkbox ("Hombre",Genero,false); this.add(chk1);
chk1.setBounds(150,460,90,20);
chk2=new Checkbox ("Mujer",Genero,true); this.add(chk2);
chk2.setBounds(240,460,100,20);
BtnPri.setBounds(new Rectangle(50,490,80,25));
BtnPri.setForeground(Color.black);
BtnPri.setLabel("PRIMERO");
BtnPri.setBackground(Color.orange);
BtnPri.setFont(new java.awt.Font("Arial",1,12));
this.add(BtnPri,null);*/
BtnAnt.setBounds(new
Rectangle(0,10,206,206));BtnAnt.setForeground(Color.green);
BtnAnt.setLabel("SUMA");
this.add(BtnAnt,null);BtnAnt.setBackground(Color.white);BtnAnt.setFont(new
java.awt.Font("Arial",1,18));
BtnSte.setBounds(new
Rectangle(411,0,206,206));BtnSte.setForeground(Color.pink);
BtnSte.setLabel("RESTA");
this.add(BtnSte,null);BtnSte.setBackground(Color.white);BtnSte.setFont(new
java.awt.Font("Arial",1,18));
BtnUlt.setBounds(new
Rectangle(0,381,206,206));BtnUlt.setForeground(Color.orange);
BtnUlt.setLabel("MULTIPLICACION");
this.add(BtnUlt,null);BtnUlt.setBackground(Color.white);BtnUlt.setFont(new
java.awt.Font("Arial",1,18));
BtnNue.setBounds(new
Rectangle(411,381,206,206));BtnNue.setForeground(Color.gray);
BtnNue.setLabel("DIVISION");
this.add(BtnNue,null);BtnNue.setBackground(Color.white);BtnNue.setFont(new
java.awt.Font("Arial",1,18));
/*BtnMod.setBounds(new
Rectangle(250,490,150,200));BtnMod.setForeground(Color.black);
BtnMod.setLabel("MODIFICAR");
this.add(BtnMod,null);BtnMod.setBackground(Color.orange);BtnMod.setFont(new
java.awt.Font("Arial",1,12));
BtnEli.setBounds(new Rectangle(50,520,80,25));
BtnEli.setForeground(Color.black); BtnEli.setLabel("ELIMINAR");
this.add(BtnEli,null);BtnEli.setBackground(Color.orange);BtnEli.setFont(new
java.awt.Font("Arial",1,12));
BtnRen.setBounds(new
Rectangle(140,520,80,25));BtnRen.setForeground(Color.white);
BtnRen.setLabel("RENOMBRAR");
this.add(BtnRen,null);BtnRen.setBackground(Color.darkGray);BtnRen.setFont(new
java.awt.Font("Arial",1,12));
BtnBus.setBounds(new
Rectangle(230,520,80,25));BtnBus.setForeground(Color.white);
BtnBus.setLabel("BUSCAR");
this.add(BtnBus,null);BtnBus.setBackground(Color.darkGray);BtnBus.setFont(new
java.awt.Font("Arial",1,12));
BtnExp.setBounds(new
Rectangle(320,520,80,25));BtnExp.setForeground(Color.white);
BtnExp.setLabel("EXPULTAR");
this.add(BtnExp,null);BtnExp.setBackground(Color.darkGray);BtnExp.setFont(new
java.awt.Font("Arial",1,12));
BtnImp.setBounds(new
Rectangle(410,520,80,25));BtnImp.setForeground(Color.green);
BtnImp.setLabel("IMPRIMIR");
this.add(BtnImp,null);BtnImp.setBackground(Color.darkGray);BtnImp.setFont(new
java.awt.Font("Arial",1,12));
BtnCan.setBounds(new
Rectangle(500,520,80,25));BtnCan.setForeground(Color.black);
BtnCan.setLabel("CANCELAR");
this.add(BtnCan,null);BtnCan.setBackground(Color.orange);BtnCan.setFont(new
java.awt.Font("Arial",1,12));
BtnSal.setBounds(new
Rectangle(230,550,80,25));BtnSal.setForeground(Color.white);
BtnSal.setLabel("SALIR");
this.add(BtnSal,null);BtnSal.setBackground(Color.black);BtnSal.setFont(new
java.awt.Font("Arial",1,12));
BtnLimp.setBounds(new
Rectangle(320,550,80,25));BtnLimp.setForeground(Color.white);
BtnLimp.setLabel("LIMPIAR"); this.add(BtnLimp,null);
BtnLimp.setBackground(Color.black);BtnLimp.setFont(new
java.awt.Font("Arial",1,12));*/
//BtnLimp.setFont(new java.awt.Font("Dialog",1,16));
}
//principal
public static void main(String args[])
{
String N=JOptionPane.showInputDialog("ingrese el
primer numero");
numero1=Integer.parseInt(N);
String N1=JOptionPane.showInputDialog("ingrese el
segundo numero");
numero2=Integer.parseInt(N1);
suma=numero1+numero2;
System.out.println(suma);
JOptionPane.showMessageDialog(null,numero1+" mas
"+numero2+" = "+suma+"\n");
}
}
if (evt.target instanceof Checkbox)
{
if(chk1.getState())
{ //llama a la correspondiente funcion
JOptionPane.showMessageDialog(null,"jiji elegiste
Hombre");
}
if(chk2.getState())
{ //llama a la correspondiente funcion
JOptionPane.showMessageDialog(null,"jeje elegiste Mujer");
}
}
return true;
}//fin action
public void limpiartbx()
{ TxtNoId.setText(" ");Txtnom1.setText(" ");Txtnom2.setText("
");TxtApe1.setText(" ");TxtApe2.setText(" ");TxtDir.setText(" ");
TxtTel.setText(" "); TxtCel.setText(" ");
TxteMa.setText(" "); TxteMi.setText(" "); TxtMun.setText(" ");
TxtDep.setText(" ");
}
private static void potencia()
{
double x,y,z;
String N=JOptionPane.showInputDialog("ingrese el numero");
x=Double.parseDouble(N);
String N1=JOptionPane.showInputDialog("ingrese el segundo numero");
y=Double.parseDouble(N1);
z = x/y;
JOptionPane.showMessageDialog(null,x+" / "+y+" = "+z+"\n");
System.out.println(z);
}
private static void tablas()
{ int numero1,numero2,resultado;
String N=JOptionPane.showInputDialog("¿Cual tablita de
multiplicar quieres ver?");
numero2=Integer.parseInt(N);
for(numero1=1;numero1<=10;numero1++)
{
resultado=numero1*numero2;
System.out.println(resultado);
JOptionPane.showMessageDialog(null,numero1+" x
"+numero2+" = "+resultado+"\n");
}
}
public void chingo()
{
int x,y,z;
String N=JOptionPane.showInputDialog("ingrese el numero");
x=Integer.parseInt(N);
String N1=JOptionPane.showInputDialog("ingrese el segundo numero ");
y=Integer.parseInt(N1);
z =x+y;
JOptionPane.showMessageDialog(null,x+" + "+y+" = "+z+"\n");
System.out.println(z);
}public void rest()
{
int x,y,z;
String N=JOptionPane.showInputDialog("ingrese el numero");
x=Integer.parseInt(N);
String N1=JOptionPane.showInputDialog("ingrese el segundo numero");
y=Integer.parseInt(N1);
z =x-y;
JOptionPane.showMessageDialog(null,x+" - "+y+" = "+z+"\n");
System.out.println(z);
}
public void mult()
{
int x,y,z;
String N=JOptionPane.showInputDialog("ingrese el numero");
x=Integer.parseInt(N);
String N1=JOptionPane.showInputDialog("ingrese el segundo numero");
y=Integer.parseInt(N1);
z =x*y;
JOptionPane.showMessageDialog(null,x+" * "+y+" = "+z+"\n");
System.out.println(z);
}
//Se desea guardar los sueldos de 5 operarios en un vector.
//Realizar la creación y carga del vector en el constructor.
public void imprimir()
{
for(int x=1;x<=15;x++)
{
if(x%2==0)
{
JOptionPane.showMessageDialog(null,x+" : es par");
if(x==4)
{
JOptionPane.showMessageDialog(null,"Estoy en Cuatro");
}
}
else
{
JOptionPane.showMessageDialog(null,x+" : es impar");
}
}
}