import java.io.*; import java.awt.*; import java.awt.event.*; import javax.swing.*; import java.util.*; //package PkgFicticia; public class ClassProveedores{ public String Nit,Empresa,Apel,Nom,Tel,Mail,Dir,Nac; // public Date Nac= new Date(); public char Sexo; public int ProvIndex=0; public int ProvMax=0; public JFrame FrmProveedores = new JFrame(" Proveedores"); public JLabel lblTitulo = new JLabel("Control de Proveedores",JLabel.CENTER); public JLabel lblIndex = new JLabel(" #/# "); public JLabel lblNit = new JLabel("Nit: "); public JLabel lblEmpresa= new JLabel("Empresa: "); public JLabel lblApel= new JLabel("Apellido: "); public JLabel lblNom = new JLabel("Nombre: "); public JLabel lblTel = new JLabel("Telefono: "); public JLabel lblMail= new JLabel("Mail: "); public JLabel lblDir = new JLabel("Direccion: "); public JLabel lblNac = new JLabel("Nacimiento: "); public JLabel lblSexo= new JLabel("Sexo: "); public JTextField txtNit = new JTextField(); public JTextField txtEmpresa = new JTextField(); public JTextField txtApel = new JTextField(15); public JTextField txtNom = new JTextField(); public JTextField txtTel = new JTextField(); public JTextField txtMail = new JTextField(); public JTextField txtDir = new JTextField(); public JTextField txtNac = new JTextField(); public JTextField txtSexo = new JTextField(); public JButton btnInicio = new JButton("<<"); public JButton btnAtras = new JButton("<"); public JButton btnUltimo = new JButton(">>"); public JButton btnAdelante= new JButton(">"); public JButton btnGuardar = new JButton("Guardar"); public JButton btnNuevo = new JButton("Nuevo"); public JButton btnBorrar = new JButton("Borrar"); public JButton btnMenu = new JButton("Ir al Menu"); public int GetMaxIndex(){ int MaxTemp=-1; for (int cont=0; cont<=50;cont=cont+1){ if(ClassFicticia.ArrProveedores[cont].Nit.trim()!=""){ MaxTemp++; } } return(MaxTemp); } public void SortProveedores(){ // NOOOO!!!!!!! no quiero hacerlo manualmente for(int conta=0; conta<=50; conta++){ for(int contb=0; contb<=50; contb++){ if(ClassFicticia.ArrProveedores[conta].Nit.compareTo(ClassFicticia.ArrProveedores[contb].Nit)>=0 ){ String StrTemp=ClassFicticia.ArrProveedores[conta].Nit; ClassFicticia.ArrProveedores[conta].Nit=ClassFicticia.ArrProveedores[contb].Nit; ClassFicticia.ArrProveedores[contb].Nit=StrTemp; StrTemp=ClassFicticia.ArrProveedores[conta].Empresa; ClassFicticia.ArrProveedores[conta].Empresa=ClassFicticia.ArrProveedores[contb].Empresa; ClassFicticia.ArrProveedores[contb].Empresa=StrTemp; StrTemp=ClassFicticia.ArrProveedores[conta].Apel; ClassFicticia.ArrProveedores[conta].Apel= ClassFicticia.ArrProveedores[contb].Apel; ClassFicticia.ArrProveedores[contb].Apel=StrTemp; StrTemp=ClassFicticia.ArrProveedores[conta].Nom; ClassFicticia.ArrProveedores[conta].Nom = ClassFicticia.ArrProveedores[contb].Nom; ClassFicticia.ArrProveedores[contb].Nom = StrTemp; StrTemp=ClassFicticia.ArrProveedores[conta].Tel; ClassFicticia.ArrProveedores[conta].Tel=ClassFicticia.ArrProveedores[contb].Tel; ClassFicticia.ArrProveedores[contb].Tel=StrTemp; StrTemp=ClassFicticia.ArrProveedores[conta].Mail; ClassFicticia.ArrProveedores[conta].Mail=ClassFicticia.ArrProveedores[contb].Mail; ClassFicticia.ArrProveedores[contb].Mail=StrTemp; StrTemp=ClassFicticia.ArrProveedores[conta].Dir; ClassFicticia.ArrProveedores[conta].Dir=ClassFicticia.ArrProveedores[contb].Dir; ClassFicticia.ArrProveedores[contb].Dir=StrTemp; StrTemp=ClassFicticia.ArrProveedores[conta].Nac; ClassFicticia.ArrProveedores[conta].Nac=ClassFicticia.ArrProveedores[contb].Nac; ClassFicticia.ArrProveedores[contb].Nac=StrTemp; char CharTemp=ClassFicticia.ArrProveedores[conta].Sexo; ClassFicticia.ArrProveedores[conta].Sexo=ClassFicticia.ArrProveedores[contb].Sexo; ClassFicticia.ArrProveedores[contb].Sexo=CharTemp; } } } for(int conta=0; conta<=50; conta++){ System.out.println( ClassFicticia.ArrProveedores[conta].Nit ); } } public void GoBottom(){ if (GetMaxIndex()==-1){ lblIndex.setText("0/0"); ProvIndex=0; ProvMax=0; }else{ ProvMax=GetMaxIndex(); ProvIndex=GetMaxIndex(); lblIndex.setText((ProvMax+1)+"/"+(ProvIndex+1)); } MostrarProveedor(ProvIndex); } public void GoTop(){ if(GetMaxIndex()==-1){ lblIndex.setText("0/0"); ProvIndex=0; ProvMax=0; }else{ ProvIndex=0; ProvMax=GetMaxIndex(); lblIndex.setText((ProvIndex+1)+"/"+(ProvMax+1)); } MostrarProveedor(ProvIndex); } public void GoUp(){ if(ProvIndex>0){ ProvIndex--; lblIndex.setText((ProvIndex+1)+"/"+(GetMaxIndex()+1)); } MostrarProveedor(ProvIndex); } public void GoDown(){ if(ProvIndex=0 ){ if(ProvIndex