Anda di halaman 1dari 110

UNIVERSIDAD NACIONAL MAYOR DE SAN MARCOS

FACULTAD DE INGENIERA DE SISTEMAS E INFORMTICA

PROYECTO DEL CURSO

Curso

Algortmica II

Proyecto

SISTEMA INMOBILIARIA

Profesora

VIRGINIA VERA POMALAZA

Integrantes

Quispe Cabrera Helder Diosdado

04200146

Guardia Durand Alex Braez Pascual Jos

06200114 09200010

2013

Sistema inmobiliario
Introduccin.
Este documento presenta el anlisis y diseo de un sistema para simular un Sistema Inmobiliario. El enfoque es detallar el sistema y no presentar un marco terico de lo que es cada uno de los temas presentados. Para el desarrollo de este diseo se han utilizado conocimientos que pueden ser encontrados en libros o en internet, pero ms que una explicacin de cada uno de estos tpicos, se detalla una propuesta concreta de un sistema que se quiere poner en marcha. Las secciones en las que se divide este documento se encuentran ordenadas de manera tal que al finalizar la lectura del mismo, cualquier persona tendr una idea bastante clara y un buen panorama de lo que se ofrece con ese sistema y de la manera en la que se va a utilizar. El sistema se analiza y expone de forma general pero a la vez se consideran muchos detalles y aspectos especficos del funcionamiento, ventajas y desventajas. Muchos de los beneficios de este sistema son indiscutibles, por lo que se afirma que es una gran opcin para cualquier universidad que desee automatizar su sistema de matrculas.

Se aclara que el enfoque que se ha hecho es para la Universidad Nacional Mayor de San Marcos pero que la misma idea se puede retomar e implementar para otros mbitos como colegios academias, etc. haciendo varias modificaciones en la estructura de la base de datos, pero conservando el mismo modelo y esquema de trabajo.

TABLA DE CONTENIDOS

1. INTRODUCCIN........................................................................................................................2 2. COMENTARIO DEL PROYECTO...................................................................................3 3. OBJETIVO....................................................................................3 4. CAPTURA DE PANTALLA IMPORTANTE..............................5 5.UML DEL PROYECTO...12 6. CODIGO DE JAVA COMENTADO.................................15 7. CONCLUSIONES......................................................................................110

COMENTARIO DEL PROYECTO


Los programas para inmobiliarias le permitirn realizar un seguimiento exhaustivo sobre cada factor que interviene en su negocio inmobiliario, para realizar satisfactoriamente una ptima gestin y administracin de este negocio. Mediante el uso del software de gestin de inmobiliarias podr trabajar fcilmente tanto en venta como en alquileres. Estos programas para inmobiliarias se caracterizan por su fcil manejo por lo que no necesita conocimientos superiores de informtica, cualquier persona podr gestionar un negocio inmobiliario sin necesidad de perder mucho tiempo aprendiendo un sistema inmobiliario y sus funciones El software para inmobiliarias cuenta con aplicaciones especficas para gestionar nuestras viviendas fcilmente.

OBJETIVOS
El principal objetivo del proyecto consiste en crear un sistema que agilice la gestin de una inmobiliaria. La aplicacin que se instalar en las PC ser sencilla e intuitiva, de manera que los empleados no necesiten apenas tiempo para aprender a manejarla con soltura. Por otro lado se quiere dotar a la aplicacin de la posibilidad de gestionar la introduccin y gestin de los distintos tipos de inmuebles por los empleados mediante el uso de diferentes puestos de escritorio. Otro objetivo es conseguir dotar a la aplicacin de un servicio de gestor de empleados y administradores mediante el cual se pueda gestionar toda la lista del personal que labora en la inmobiliaria. Tambin se a dotado a la aplicacin de un mdulo que permita a los empleados obtener informes todo el personal de la empresa.

CAPTURA DE PANTALLAS MS IMPORTANTES

UML DEL PROYECTO

CODIGO JAVA :COMENTADO


El proyecto est dividido en capas, las cuales contienen 4 paquetes separadas segn el tipo de cdigo que realizan.

Paquete Entidades: donde se encuentra las clases de las entidades involucradas en el


proyecto. Clase Persona package Entidades; import java.io.*; public class Persona implements Serializable{ //Atributos protected String apePaterno, apeMaterno,nombres,dni,celular; protected int dia,mes,anio; //Constructor de persona public Persona() { } public Persona(String apePaterno,String apeMaterno, String nombres, String dni, String telefono, int dia, int mes, int anio) { this.apePaterno = apePaterno; this.apeMaterno = apeMaterno; this.nombres = nombres; this.dni = dni; this.celular = telefono; this.dia = dia; this.mes = mes; this.anio = anio; }//metodos set y get de los atributos de persona

} Clase Personal package Entidades; import java.io.*;

public class Personal extends Persona implements Serializable{ private String password; private String codigoPersonal; private String categoriaPersonal; /* * categoriaPersonal=Adminstrador------->vendedor con calidad de administrador * categoriaPersonal=Vendedor------->vendedor con restriccion * La unica diferencia es que solo el administrador puede registrar personal y registrar inmuebles. */ public Personal(String password, String codigoPersonal, String categoriaPersonal, String apePaterno, String apeMaterno, String nombres, String dni, String telefono, int dia, int mes, int anio) { super(apePaterno, apeMaterno, nombres, dni, telefono, dia, mes, anio); this.password = password; this.codigoPersonal = codigoPersonal; this.categoriaPersonal = categoriaPersonal; } public Personal(String categoriaPersonal) { this.categoriaPersonal = categoriaPersonal; }

public Personal(){ } //set y get de los atributos }

Clase Inmueble package Entidades; import java.io.Serializable; public class Inmueble implements Serializable{ private String codigoInmueble; private double precio; private double largo; private double ancho; private String zona; private int tipo;//tipo=1 es venta // tipo=2 es alquiler private String categoria; private String descripcion; private boolean disponibilidad;//true=no alquilado //false= alquilado public Inmueble(String codigoInmueble, double precio, double largo, double ancho, String zona, int tipo, String categoria, String descripcion) { this.codigoInmueble = codigoInmueble; this.precio = precio; this.largo = largo; this.ancho = ancho; this.zona = zona;

this.tipo = tipo; this.categoria = categoria; this.descripcion = descripcion; this.disponibilidad=true; } public Inmueble() { } // set y get

Clase BaseDatos package Entidades;

import Util.UtilVista; import java.io.EOFException; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.IOException; import java.io.ObjectInputStream; import java.io.ObjectOutputStream; import java.util.ArrayList;

public class BaseDatos { public BaseDatos() {

crearArchivoLsPersonal(); crearArchivoLsInmuebles(); crearArchivoLsInmueblesVendidosAlquilados(); if(cantidadDePersonal()==0){ crearArchivoLsPersonal(); } if(cantidadDeInmuebles()==0){ crearArchivoLsInmuebles(); }

} //inicializamos algunos objetos public void crearArchivoLsPersonal(){ Personal administrador=new Personal("1","1","Administrador","Perez","de las Casas","Pedro","47344919","984736746",9,9,1992) ; Personal vendedor1=new Personal("3","3","Vendedor","Castillo","Paredes","Renzo","34577345","987890656",4,6,1 980) ; try{ FileOutputStream stream= new FileOutputStream("src\\jpackArchivos\\LsPersonal.dat"); ObjectOutputStream salida = new ObjectOutputStream(stream); salida.writeUnshared(administrador); salida.writeUnshared(vendedor1); salida.flush(); stream.close(); }catch(IOException e){

UtilVista.mostrarMensajeAdvertencia("Error de E/S de archivo"); } } public void crearArchivoLsInmuebles(){ Inmueble inmueble1=new Inmueble("428492",3000,100,100,"Chorrillos",1,"Casa","Casa de 2 pisos"); Inmueble inmueble2=new Inmueble("757899",23000,300,300,"Santa Clara",2,"Departamento","Departamento de 10 pisos"); Inmueble inmueble3=new Inmueble("598389",7500,200,530,"Cercado de Lima",1,"Local","Local de 4 pisos"); Inmueble inmueble4=new Inmueble("894679",5200,400,700,"Brea",1,"Terreno","Terreno cerca a la municipalidad de Brea"); try{ FileOutputStream stream= new FileOutputStream("src\\jpackArchivos\\LsInmuebles.dat"); ObjectOutputStream salida = new ObjectOutputStream(stream); salida.writeUnshared(inmueble1); salida.writeUnshared(inmueble2); salida.writeUnshared(inmueble3); salida.writeUnshared(inmueble4); salida.flush(); stream.close(); }catch(IOException e){ UtilVista.mostrarMensajeAdvertencia("Error de E/S de archivo"); } }

public void crearArchivoLsInmueblesVendidosAlquilados(){ Inmueble inmueble1=new Inmueble("465744",3000,100,100,"Chorrillos",1,"Casa","Casa de 2 pisos"); Inmueble inmueble2=new Inmueble("909000",23000,300,300,"Santa Clara",2,"Departamento","Departamento de 10 pisos"); Inmueble inmueble3=new Inmueble("436435",7500,200,530,"Cercado de Lima",1,"Local","Local de 4 pisos"); Inmueble inmueble4=new Inmueble("634859",5200,400,700,"Brea",1,"Terreno","Terreno cerca a la municipalidad de Brea"); try{ FileOutputStream stream= new FileOutputStream("src\\jpackArchivos\\LsInmueblesVendidosAlquilados.dat"); ObjectOutputStream salida = new ObjectOutputStream(stream); salida.writeUnshared(inmueble1); salida.writeUnshared(inmueble2); salida.writeUnshared(inmueble3); salida.writeUnshared(inmueble4); salida.flush(); stream.close(); }catch(IOException e){ UtilVista.mostrarMensajeAdvertencia("Error de E/S de archivo"); } } public static int cantidadDePersonal() { int contador = 0; try {

FileInputStream stream = new FileInputStream("src\\jpackArchivos\\LsPersonal.dat"); ObjectInputStream entrada = new ObjectInputStream(stream); Personal personalAux; while ((personalAux = (Personal) entrada.readObject()) != null) { contador++; } stream.close();

} catch (EOFException e) { } catch (IOException e) {//Mostrar mensaje de error si no se puede leer el arcivo //UtilVista.mostrarMensajeAdvertencia("Error al leer el Archivo"); } catch (ClassNotFoundException e) {//Mostrar mensaje de error si no se encuentra la clase UtilVista.mostrarMensajeAdvertencia("Clase no encontrada");

} return contador; } public static int cantidadDeInmuebles() { int contador = 0; try { FileInputStream stream = new FileInputStream("src\\jpackArchivos\\LsInmuebles.dat"); ObjectInputStream entrada = new ObjectInputStream(stream); Inmueble inmuebleAux;

while ((inmuebleAux = (Inmueble) entrada.readObject()) != null) { contador++; } stream.close();

} catch (EOFException e) { } catch (IOException e) {//Mostrar mensaje de error si no se puede leer el arcivo //UtilVista.mostrarMensajeAdvertencia("Error al leer el Archivo"); } catch (ClassNotFoundException e) {//Mostrar mensaje de error si no se encuentra la clase UtilVista.mostrarMensajeAdvertencia("Clase no encontrada"); } return contador; } }

Paquete Modelo : Paquete donde se encuentra las clases que realizan los
manejos de archivos(persistencia) Clase Gestor package Modelo; import Entidades.BaseDatos;

public abstract class Gestor { protected static BaseDatos baseDeDatos; static{

baseDeDatos = new BaseDatos(); } }

Interface InterfacePersistencia package Modelo; public interface InterfacePersisntencia {

public void aadirArchivo(Object objeto);

public boolean verificaQueNoHayaCodigosRepetidos(String codigo); }

Clase MiObjectOutputStream package Modelo;

import java.io.IOException; import java.io.ObjectOutputStream; import java.io.OutputStream;

public class MiObjectOutputStream extends ObjectOutputStream {

/* Constructor que recibe OutputStream */

public MiObjectOutputStream(OutputStream out) throws IOException { super(out); }

/** Constructor sin parmetros */ protected MiObjectOutputStream() throws IOException, SecurityException { super(); } //Redefinicin del mtodo de escribir la cabecera para que no haga nada. protected void writeStreamHeader() throws IOException { } }

Clase GestorDeInmuebles package Modelo;

import Entidades.Inmueble; import Entidades.Personal; import Util.UtilVista; import java.io.EOFException; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.IOException;

import java.io.ObjectInputStream; import java.io.ObjectOutputStream; import java.util.ArrayList;

public class GestorDeInmuebles extends Gestor implements InterfacePersisntencia {

public void aadirInmueblesAlArrayInmueblesVendidosAlquilados(Inmueble inmueble) { ObjectOutputStream salida = null; try { salida = new MiObjectOutputStream(new FileOutputStream("src\\jpackArchivos\\LsInmueblesVendidosAlquilados.dat", true)); salida.writeUnshared(inmueble); salida.close(); } catch (IOException e) { } finally { try { salida.close(); } catch (Exception e) { } } }

public int cantidadDeInmueblesVendidos() { int contador = 0; try { FileInputStream stream = new FileInputStream("src\\jpackArchivos\\LsInmueblesVendidosAlquilados.dat"); ObjectInputStream entrada = new ObjectInputStream(stream); Inmueble inmuebleAux; while ((inmuebleAux = (Inmueble) entrada.readObject()) != null) { if (inmuebleAux.getTipo() == 1) { contador++; } } stream.close();

} catch (EOFException e) { } catch (IOException e) {//Mostrar mensaje de error si no se puede leer el arcivo //UtilVista.mostrarMensajeAdvertencia("Error al leer el Archivo"); } catch (ClassNotFoundException e) {//Mostrar mensaje de error si no se encuentra la clase UtilVista.mostrarMensajeAdvertencia("Clase no encontrada");

return contador; }

public int cantidadDeInmueblesAlquilados() { int contador = 0; try { FileInputStream stream = new FileInputStream("src\\jpackArchivos\\LsInmueblesVendidosAlquilados.dat"); ObjectInputStream entrada = new ObjectInputStream(stream); Inmueble inmuebleAux; while ((inmuebleAux = (Inmueble) entrada.readObject()) != null) { if (inmuebleAux.getTipo() == 2) { contador++; } } stream.close();

} catch (EOFException e) { } catch (IOException e) {//Mostrar mensaje de error si no se puede leer el arcivo //UtilVista.mostrarMensajeAdvertencia("Error al leer el Archivo"); } catch (ClassNotFoundException e) {//Mostrar mensaje de error si no se encuentra la clase UtilVista.mostrarMensajeAdvertencia("Clase no encontrada");

} return contador; }

public void aadirArchivo(Object inmueble) { ObjectOutputStream salida = null; try { salida = new MiObjectOutputStream(new FileOutputStream("src\\jpackArchivos\\LsInmuebles.dat", true)); salida.writeUnshared(inmueble); salida.close(); } catch (IOException e) { } finally { try { salida.close(); } catch (Exception e) { } } UtilVista.mostrarMensaje("Registro realizado con xito"); }

public boolean verificaQueNoHayaCodigosRepetidos(String codigoInmueble) {

boolean encontrado = true; try { FileInputStream stream = new FileInputStream("src\\jpackArchivos\\LsInmuebles.dat"); ObjectInputStream entrada = new ObjectInputStream(stream); Inmueble inmuebleAux; while ((inmuebleAux = (Inmueble) entrada.readObject()) != null) { if (codigoInmueble.equals(inmuebleAux.getCodigoInmueble())) { encontrado = false; } } stream.close();

} catch (EOFException e) { } catch (IOException e) {//Mostrar mensaje de error si no se puede leer el arcivo UtilVista.mostrarMensajeAdvertencia("Error al leer el Archivo"); } catch (ClassNotFoundException e) {//Mostrar mensaje de error si no se encuentra la clase UtilVista.mostrarMensajeAdvertencia("Clase no encontrada");

} return encontrado; }

public Inmueble buscarInmueblePorCodigo(String codigoInmueble) { Inmueble inmueble = null; try { FileInputStream stream = new FileInputStream("src\\jpackArchivos\\LsInmuebles.dat"); ObjectInputStream entrada = new ObjectInputStream(stream); Inmueble inmuebleAux; while ((inmuebleAux = (Inmueble) entrada.readObject()) != null) { if (codigoInmueble.equals(inmuebleAux.getCodigoInmueble())) { inmueble = inmuebleAux; } } stream.close();

} catch (EOFException e) { } catch (IOException e) {//Mostrar mensaje de error si no se puede leer el arcivo UtilVista.mostrarMensajeAdvertencia("Error al leer el Archivo"); } catch (ClassNotFoundException e) {//Mostrar mensaje de error si no se encuentra la clase UtilVista.mostrarMensajeAdvertencia("Clase no encontrada"); } return inmueble;

} }

Clase GestorDeSeguridad package Modelo;

import Entidades.Personal; import Util.UtilVista; import java.io.EOFException; import java.io.FileInputStream; import java.io.IOException; import java.io.ObjectInputStream; import java.util.ArrayList; import javax.swing.JTable;

public class GestorDeSeguridad extends Gestor { private static boolean permisoUsuarioActivo;//servira para los permisos del usuario en el sistema public boolean verificaUsuarioPassword(String codigoPersonal, String password) { boolean encontrado= false; int i=0; try {

ObjectInputStream entrada = new ObjectInputStream(new FileInputStream("src\\jpackArchivos\\LsPersonal.dat")); Personal personalAux; while ((personalAux = (Personal) entrada.readObject()) != null) { if (codigoPersonal.equals(personalAux.getCodigoPersonal()) && password.equals(personalAux.getPassword())) { if(personalAux.getCategoriaPersonal().equals("Administrador")){ permisoUsuarioActivo=true; }else{ permisoUsuarioActivo=false; } encontrado = true; i++; } } entrada.close();

} catch (EOFException e) {

}catch (IOException e) {//Mostrar mensaje de error si no se puede leer el arcivo UtilVista.mostrarMensajeAdvertencia("Error al leer el Archivo"); }

catch (ClassNotFoundException e) {//Mostrar mensaje de error si no se encuentra la clase UtilVista.mostrarMensajeAdvertencia("Clase no encontrada"); } return encontrado; }

public boolean isPermisoUsuarioActivo() { return permisoUsuarioActivo; } }

Clase GestorDePersonal

package Modelo;

import Entidades.Personal; import Util.UtilVista; import java.io.EOFException; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.IOException; import java.io.ObjectInputStream;

import java.io.ObjectOutputStream; import java.util.ArrayList; import java.util.logging.Level; import java.util.logging.Logger;

public class GestorDePersonal extends Gestor implements InterfacePersisntencia {

public void aadirArchivo(Object personal) { ObjectOutputStream salida = null; try { salida = new MiObjectOutputStream(new FileOutputStream("src\\jpackArchivos\\LsPersonal.dat", true)); salida.writeUnshared(personal); salida.close(); } catch (IOException e) { } finally { try { salida.close(); } catch (Exception e) { } } UtilVista.mostrarMensaje("Registro realizado con xito");

} public boolean verificaQueNoHayaCodigosRepetidos(String codigoPersonal) { boolean encontrado = true; int i = 0; try { FileInputStream stream = new FileInputStream("src\\jpackArchivos\\LsPersonal.dat"); ObjectInputStream entrada = new ObjectInputStream(stream); Personal personalAux; while ((personalAux = (Personal) entrada.readObject()) != null) { if (codigoPersonal.equals(personalAux.getCodigoPersonal())) { encontrado = false; i++; } } stream.close();

} catch (EOFException e) { } catch (IOException e) {//Mostrar mensaje de error si no se puede leer el arcivo UtilVista.mostrarMensajeAdvertencia("Error al leer el Archivo"); } catch (ClassNotFoundException e) {//Mostrar mensaje de error si no se encuentra la clase

UtilVista.mostrarMensajeAdvertencia("Clase no encontrada");

} return encontrado; } }

Paquete Vistas: este paquete contiene los frame de java donde se encuentran las clases donde estn los ingresos de datos y los eventos de los jbutton.
Clase jFrameEntrada package Vistas;

import Modelo.GestorDeSeguridad; import Util.UtilVista; import java.awt.Dimension; import java.io.IOException; import java.util.logging.Level; import java.util.logging.Logger; import javax.swing.JFrame; import javax.swing.JPanel;

public class jFrameEntrada extends javax.swing.JFrame { GestorDeSeguridad gestorDeSeguridad;

public jFrameEntrada() { gestorDeSeguridad=new GestorDeSeguridad(); initComponents(); setTitle("Sistema Inmobiliario"); setResizable(false); setSize(555, 550); setLocationRelativeTo(null); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); } private void initComponents() { jLabel1 = new javax.swing.JLabel(); jLabel2 = new javax.swing.JLabel(); jbtnSalir = new javax.swing.JButton(); jLabel3 = new javax.swing.JLabel(); jPanel1 = new javax.swing.JPanel(); jbtnregistrar = new javax.swing.JButton(); jbtnMantenimiento = new javax.swing.JButton(); jbtnRelacionPersonal = new javax.swing.JButton(); jbtnRelacionInmuebles = new javax.swing.JButton(); jbtnVentaAlquiler = new javax.swing.JButton(); jButton1 = new javax.swing.JButton();

getContentPane().setLayout(null);

jLabel1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Imagenes/perfil.jpg"))); // NOI18N jLabel1.setText("jLabel1"); getContentPane().add(jLabel1); jLabel1.setBounds(20, 130, 240, 280);

jLabel2.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N jLabel2.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Imagenes/menuPrincipal.png"))); // NOI18N getContentPane().add(jLabel2); jLabel2.setBounds(50, 30, 300, 90);

jbtnSalir.setText("SALIR"); jbtnSalir.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jbtnSalirActionPerformed(evt); } }); getContentPane().add(jbtnSalir); jbtnSalir.setBounds(270, 470, 70, 39);

jLabel3.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Imagenes/salida[1].gif"))); // NOI18N getContentPane().add(jLabel3); jLabel3.setBounds(200, 470, 50, 40);

jPanel1.setBorder(javax.swing.BorderFactory.createEtchedBorder()); jPanel1.setLayout(null);

jbtnregistrar.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N jbtnregistrar.setText("REGISTRAR"); jbtnregistrar.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jbtnregistrarActionPerformed(evt); } }); jPanel1.add(jbtnregistrar); jbtnregistrar.setBounds(260, 60, 252, 34);

jbtnMantenimiento.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N jbtnMantenimiento.setText("MANTENIMIENTO DE INMUEBLES"); jbtnMantenimiento.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jbtnMantenimientoActionPerformed(evt); } }); jPanel1.add(jbtnMantenimiento); jbtnMantenimiento.setBounds(260, 110, 252, 37);

jbtnRelacionPersonal.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N jbtnRelacionPersonal.setText("RELACION DE PERSONAL");

jbtnRelacionPersonal.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jbtnRelacionPersonalActionPerformed(evt); } }); jPanel1.add(jbtnRelacionPersonal); jbtnRelacionPersonal.setBounds(260, 210, 252, 37);

jbtnRelacionInmuebles.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N jbtnRelacionInmuebles.setText("RELACION DE INMUEBLES"); jbtnRelacionInmuebles.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jbtnRelacionInmueblesActionPerformed(evt); } }); jPanel1.add(jbtnRelacionInmuebles); jbtnRelacionInmuebles.setBounds(260, 260, 252, 40);

jbtnVentaAlquiler.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N jbtnVentaAlquiler.setText("VENTA Y ALQUILER DE INMUEBLES"); jbtnVentaAlquiler.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jbtnVentaAlquilerActionPerformed(evt); } });

jPanel1.add(jbtnVentaAlquiler); jbtnVentaAlquiler.setBounds(260, 160, 252, 37);

jButton1.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N jButton1.setText("VER GANANCIAS"); jButton1.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton1ActionPerformed(evt); } }); jPanel1.add(jButton1); jButton1.setBounds(260, 310, 250, 40);

getContentPane().add(jPanel1); jPanel1.setBounds(10, 70, 530, 380); }// </editor-fold>

public static void main(String[] args) { new jFrameEntrada().setVisible(true); } private void jbtnregistrarActionPerformed(java.awt.event.ActionEvent evt) { // TODO add your handling code here: if (!gestorDeSeguridad.isPermisoUsuarioActivo()) { UtilVista.mostrarMensajeAdvertencia("No tiene permiso"); } else {

this.dispose(); jFrameRegistrarMenu jframeRegistrarMenu = new jFrameRegistrarMenu(); jframeRegistrarMenu.setLocationRelativeTo(null); jframeRegistrarMenu.setVisible(true); } } private void jbtnMantenimientoActionPerformed(java.awt.event.ActionEvent evt) { // TODO add your handling code here: this.dispose(); jFrameMantenimientoMenu jframeMantMenu = new jFrameMantenimientoMenu(); jframeMantMenu.setLocationRelativeTo(null); jframeMantMenu.setVisible(true); } private void jbtnSalirActionPerformed(java.awt.event.ActionEvent evt) { // TODO add your handling code here: //UtilVista.cambiarPanel(this, new jPanIniciarSesion()); this.dispose(); jFrameIniciarSesion jframeIniciarSesion = new jFrameIniciarSesion(); jframeIniciarSesion.setLocationRelativeTo(null); jframeIniciarSesion.setVisible(true); } private void jbtnVentaAlquilerActionPerformed(java.awt.event.ActionEvent evt) { // TODO add your handling code here: this.dispose();

jFrameVentaAlquilerDeInmuebles jframeVentaAlquilerInmuebles = new jFrameVentaAlquilerDeInmuebles(); jframeVentaAlquilerInmuebles.setLocationRelativeTo(null); jframeVentaAlquilerInmuebles.setVisible(true); } private void jbtnRelacionPersonalActionPerformed(java.awt.event.ActionEvent evt) { try { // TODO add your handling code here: this.dispose(); jFrameMostrarPersonal jframeMostrarPersonal = new jFrameMostrarPersonal(); jframeMostrarPersonal.setLocationRelativeTo(null); jframeMostrarPersonal.setVisible(true); } catch (IOException ex) { UtilVista.mostrarMensajeAdvertencia("Error al leer el Archivo"); }

} private void jbtnRelacionInmueblesActionPerformed(java.awt.event.ActionEvent evt) { try { // TODO add your handling code here: this.dispose(); jFrameMostrarInmuebles jframeMostrarInmuebles = new jFrameMostrarInmuebles(); jframeMostrarInmuebles.setLocationRelativeTo(null); jframeMostrarInmuebles.setVisible(true); } catch (IOException ex) {

Logger.getLogger(jFrameEntrada.class.getName()).log(Level.SEVERE, null, ex); } } private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) { // TODO add your handling code here:

// TODO add your handling code here: this.dispose(); jFrameMostrarGanacias jframeMostrarGanancias = new jFrameMostrarGanacias(); jframeMostrarGanancias.setLocationRelativeTo(null); jframeMostrarGanancias.setVisible(true); } // Variables declaration - do not modify private javax.swing.JButton jButton1; private javax.swing.JLabel jLabel1; private javax.swing.JLabel jLabel2; private javax.swing.JLabel jLabel3; private javax.swing.JPanel jPanel1; private javax.swing.JButton jbtnMantenimiento; private javax.swing.JButton jbtnRelacionInmuebles; private javax.swing.JButton jbtnRelacionPersonal; private javax.swing.JButton jbtnSalir; private javax.swing.JButton jbtnVentaAlquiler; private javax.swing.JButton jbtnregistrar; }

Clase jFrameIniciarSesion
package Vistas;

import Modelo.GestorDeSeguridad; import ProgramaPrincipal.ProgramaPrincipal; import Util.UtilVista; import javax.swing.JFrame; import javax.swing.JOptionPane; public class jFrameIniciarSesion extends javax.swing.JFrame { private GestorDeSeguridad gestorDeSeguridad; private boolean verificarIngreso;

public jFrameIniciarSesion() { verificarIngreso = false; gestorDeSeguridad = new GestorDeSeguridad(); initComponents(); setTitle("Sistema Inmobiliario"); setResizable(false); setSize(624, 640); setLocationRelativeTo(null); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); } private void initComponents() {

jbtOk = new javax.swing.JButton();

jLabel6 = new javax.swing.JLabel(); jLabel1 = new javax.swing.JLabel(); jPanel1 = new javax.swing.JPanel(); jpasContrasea = new javax.swing.JPasswordField(); jtxfUsuario = new javax.swing.JTextField(); jLabel4 = new javax.swing.JLabel(); jLabel3 = new javax.swing.JLabel(); jPanel2 = new javax.swing.JPanel(); jbtEntrar = new javax.swing.JButton(); jLabel5 = new javax.swing.JLabel(); jbtnSalir = new javax.swing.JButton();

setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); getContentPane().setLayout(null);

jbtOk.setText("OK"); jbtOk.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jbtOkActionPerformed(evt); } }); getContentPane().add(jbtOk); jbtOk.setBounds(500, 80, 60, 30);

jLabel6.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N

jLabel6.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Imagenes/Titulo.png"))); // NOI18N getContentPane().add(jLabel6); jLabel6.setBounds(90, 20, 290, 40);

jLabel1.setFont(new java.awt.Font("Stencil", 0, 24)); // NOI18N jLabel1.setForeground(new java.awt.Color(51, 0, 204)); jLabel1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Imagenes/SistemaInmobiliario.png"))); // NOI18N getContentPane().add(jLabel1); jLabel1.setBounds(80, 150, 293, 90);

jPanel1.setBorder(javax.swing.BorderFactory.createEtchedBorder());

jpasContrasea.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jpasContraseaActionPerformed(evt); } });

jtxfUsuario.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jtxfUsuarioActionPerformed(evt); } });

jLabel4.setText("CONTRASEA");

jLabel3.setText("USUARIO");

javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1); jPanel1.setLayout(jPanel1Layout); jPanel1Layout.setHorizontalGroup(

jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup() .addContainerGap(39, Short.MAX_VALUE) .addComponent(jLabel3, javax.swing.GroupLayout.PREFERRED_SIZE, 60, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jtxfUsuario, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(18, 18, 18) .addComponent(jLabel4, javax.swing.GroupLayout.PREFERRED_SIZE, 89, javax.swing.GroupLayout.PREFERRED_SIZE)

.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(jpasContrasea, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(116, 116, 116)) ); jPanel1Layout.setVerticalGroup(

jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup() .addContainerGap(45, Short.MAX_VALUE)

.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASE LINE) .addComponent(jpasContrasea, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jtxfUsuario, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel4, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel3, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(21, 21, 21)) );

getContentPane().add(jPanel1); jPanel1.setBounds(50, 40, 540, 90);

jPanel2.setBorder(javax.swing.BorderFactory.createEtchedBorder());

jbtEntrar.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N jbtEntrar.setText("ENTRAR");

jbtEntrar.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jbtEntrarActionPerformed(evt); } });

jLabel5.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Imagenes/inmobiliaria.jpg"))); // NOI18N jLabel5.setText("jLabel5");

jbtnSalir.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N jbtnSalir.setText("SALIR"); jbtnSalir.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jbtnSalirActionPerformed(evt); } });

javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2); jPanel2.setLayout(jPanel2Layout); jPanel2Layout.setHorizontalGroup(

jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel2Layout.createSequentialGroup() .addContainerGap(60, Short.MAX_VALUE)

.addComponent(jLabel5, javax.swing.GroupLayout.PREFERRED_SIZE, 411, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(55, 55, 55)) .addGroup(jPanel2Layout.createSequentialGroup() .addGap(146, 146, 146) .addComponent(jbtEntrar, javax.swing.GroupLayout.PREFERRED_SIZE, 104, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(35, 35, 35) .addComponent(jbtnSalir, javax.swing.GroupLayout.PREFERRED_SIZE, 104, javax.swing.GroupLayout.PREFERRED_SIZE) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) ); jPanel2Layout.setVerticalGroup(

jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel2Layout.createSequentialGroup() .addContainerGap(65, Short.MAX_VALUE) .addComponent(jLabel5, javax.swing.GroupLayout.PREFERRED_SIZE, 288, javax.swing.GroupLayout.PREFERRED_SIZE)

.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)

.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASE LINE) .addComponent(jbtnSalir) .addComponent(jbtEntrar)) .addContainerGap())

); getContentPane().add(jPanel2); jPanel2.setBounds(50, 190, 530, 410);

pack(); }// </editor-fold>

private void jtxfUsuarioActionPerformed(java.awt.event.ActionEvent evt) {

private void jpasContraseaActionPerformed(java.awt.event.ActionEvent evt) { }

private void jbtOkActionPerformed(java.awt.event.ActionEvent evt) { // TODO add your handling code here: String codigo_vendedor = jtxfUsuario.getText(); String password = jpasContrasea.getText(); verificarIngreso = gestorDeSeguridad.verificaUsuarioPassword(codigo_vendedor, password); if (!verificarIngreso) { JOptionPane.showMessageDialog(null, "Datos Incorrectos", "Iniciar Sesion", JOptionPane.ERROR_MESSAGE); jtxfUsuario.setText(""); jpasContrasea.setText(""); } else {

JOptionPane.showMessageDialog(null, "Datos Correctos", "Iniciar Sesion", JOptionPane.INFORMATION_MESSAGE); } }

private void jbtEntrarActionPerformed(java.awt.event.ActionEvent evt) { // TODO add your handling code here: if (verificarIngreso) { this.dispose(); jFrameEntrada jFrameEntrada = new jFrameEntrada(); jFrameEntrada.setLocationRelativeTo(null); jFrameEntrada.setVisible(true); } else { UtilVista.mostrarMensajeAdvertencia("Verifique datos"); } } private void jbtnSalirActionPerformed(java.awt.event.ActionEvent evt) { // TODO add your handling code here: if (JOptionPane.showConfirmDialog(null, new Object[]{"Seguro desea salir"}, "Verificar", JOptionPane.OK_CANCEL_OPTION) == JOptionPane.YES_OPTION) { System.exit(0); }

private javax.swing.JLabel jLabel1;

private javax.swing.JLabel jLabel3; private javax.swing.JLabel jLabel4; private javax.swing.JLabel jLabel5; private javax.swing.JLabel jLabel6; private javax.swing.JPanel jPanel1; private javax.swing.JPanel jPanel2; private javax.swing.JButton jbtEntrar; private javax.swing.JButton jbtOk; private javax.swing.JButton jbtnSalir; private javax.swing.JPasswordField jpasContrasea; private javax.swing.JTextField jtxfUsuario; // End of variables declaration }

Clase jFrameMantenimientoCasa
package Vistas;

import Entidades.Inmueble; import Modelo.GestorDeInmuebles; import Util.UtilVista; import java.awt.event.KeyEvent; import java.awt.event.KeyListener; import java.io.EOFException; import java.io.FileInputStream; import java.io.FileOutputStream;

import java.io.IOException; import java.io.ObjectInputStream; import java.io.ObjectOutputStream; import java.util.ArrayList; import javax.swing.JFrame;

public class jFrameMantenimientoCasa extends javax.swing.JFrame { GestorDeInmuebles gestorDeInmuebles;

public jFrameMantenimientoCasa() { gestorDeInmuebles = new GestorDeInmuebles(); initComponents(); setTitle("Sistema Inmobiliario"); setResizable(false); setSize(675, 600); setLocationRelativeTo(null); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); jtxfLargo.setEditable(false); jtxfAncho.setEditable(false); jtxfPrecio.setEditable(false); jTextAreaDescripcion.setEnabled(false); jComboBoxZona.setEnabled(false); jradioBtnAlquiler.setEnabled(false); jradioBtnVenta.setEnabled(false);

jtxfCodigo.addKeyListener(new KeyListener() { public void keyTyped(KeyEvent e) { }

@Override public void keyPressed(KeyEvent e) { char c = e.getKeyChar(); if (c == KeyEvent.VK_ENTER) { Inmueble inmueble = gestorDeInmuebles.buscarInmueblePorCodigo(jtxfCodigo.getText()); if (inmueble != null) { if (inmueble.getCategoria().equals("Casa") && gestorDeInmuebles.verificaQueNoHayaCodigosRepetidos(jtxfCodigo.getText()) == false) { jtxfLargo.setEditable(true); jtxfAncho.setEditable(true); jtxfPrecio.setEditable(true); jTextAreaDescripcion.setEnabled(true); jComboBoxZona.setEnabled(true); jradioBtnAlquiler.setEnabled(true); jradioBtnVenta.setEnabled(true); jtxfLargo.setText(String.valueOf(inmueble.getLargo())); jtxfAncho.setText(String.valueOf(inmueble.getAncho())); jtxfPrecio.setText(String.valueOf(inmueble.getPrecio())); ArrayList<String> zona = new ArrayList<String>(); zona.add("Jesus Mara"); zona.add("Miraflores");

zona.add("Surco"); zona.add("Cercado de Lima"); zona.add("San Miguel"); zona.add("Puebo Libre"); zona.add("Brea"); zona.add("Chorrillos"); zona.add("Santa Clara"); for (int i = 0; i < zona.size(); i++) { if (zona.get(i).equals(inmueble.getZona())) { jComboBoxZona.setSelectedIndex(i); } }

jTextAreaDescripcion.setText(inmueble.getDescripcion()); if (inmueble.getTipo() == 1) { jradioBtnVenta.setSelected(true); } else { jradioBtnAlquiler.setSelected(true); } if(inmueble.isDisponibilidad()==true){ jRadioButtonSI.setSelected(true); }else{ jRadioButtonNO.setSelected(true); } } else {

UtilVista.mostrarMensajeAdvertencia("Codigo de Casa erroneo"); } } else { UtilVista.mostrarMensajeAdvertencia("Codigo de Casa erroneo"); } } }

@Override public void keyReleased(KeyEvent e) { } }); jtxfPrecio.addKeyListener(new KeyListener() { public void keyTyped(KeyEvent e) { char c = e.getKeyChar(); if (!Character.isDigit(c) && c != KeyEvent.VK_PERIOD && c != KeyEvent.VK_BACK_SPACE) { e.consume(); } }

@Override public void keyPressed(KeyEvent e) { }

@Override public void keyReleased(KeyEvent e) { } });

jtxfLargo.addKeyListener(new KeyListener() { public void keyTyped(KeyEvent e) { char c = e.getKeyChar(); if (!Character.isDigit(c) && c != KeyEvent.VK_PERIOD && c != KeyEvent.VK_BACK_SPACE) { e.consume(); } }

@Override public void keyPressed(KeyEvent e) { }

@Override public void keyReleased(KeyEvent e) { } }); jtxfAncho.addKeyListener(new KeyListener() { public void keyTyped(KeyEvent e) { char c = e.getKeyChar();

if (!Character.isDigit(c) && c != KeyEvent.VK_PERIOD && c != KeyEvent.VK_BACK_SPACE) { e.consume(); } }

@Override public void keyPressed(KeyEvent e) { }

@Override public void keyReleased(KeyEvent e) { } });

private void initComponents() {

buttonGroupTipo = new javax.swing.ButtonGroup(); buttonGroupDisponibilidad = new javax.swing.ButtonGroup(); jLabel1 = new javax.swing.JLabel(); jLabel2 = new javax.swing.JLabel(); jbtnAceptar = new javax.swing.JButton(); jbtnCancelar = new javax.swing.JButton();

jPanel1 = new javax.swing.JPanel(); jComboBoxOpcion = new javax.swing.JComboBox(); jtxfCodigo = new javax.swing.JTextField(); jtxfLargo = new javax.swing.JTextField(); jtxfAncho = new javax.swing.JTextField(); jtxfPrecio = new javax.swing.JTextField(); jScrollPane1 = new javax.swing.JScrollPane(); jTextAreaDescripcion = new javax.swing.JTextArea(); jLabel6 = new javax.swing.JLabel(); jComboBoxZona = new javax.swing.JComboBox(); jLabel7 = new javax.swing.JLabel(); jLabel4 = new javax.swing.JLabel(); jLabel5 = new javax.swing.JLabel(); jLabel3 = new javax.swing.JLabel(); jLabel9 = new javax.swing.JLabel(); jLabel10 = new javax.swing.JLabel(); jradioBtnVenta = new javax.swing.JRadioButton(); jradioBtnAlquiler = new javax.swing.JRadioButton(); jLabel11 = new javax.swing.JLabel(); jRadioButtonNO = new javax.swing.JRadioButton(); jRadioButtonSI = new javax.swing.JRadioButton(); jLabel12 = new javax.swing.JLabel();

setPreferredSize(new java.awt.Dimension(630, 470)); getContentPane().setLayout(null);

jLabel1.setFont(new java.awt.Font("Rockwell", 1, 18)); // NOI18N jLabel1.setForeground(new java.awt.Color(0, 0, 255)); jLabel1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Imagenes/mantCasa.png"))); // NOI18N getContentPane().add(jLabel1); jLabel1.setBounds(30, 30, 330, 60);

jLabel2.setText("Opcion"); getContentPane().add(jLabel2); jLabel2.setBounds(20, 110, 60, 20);

jbtnAceptar.setText("Aceptar"); jbtnAceptar.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jbtnAceptarActionPerformed(evt); } }); getContentPane().add(jbtnAceptar); jbtnAceptar.setBounds(190, 510, 110, 30);

jbtnCancelar.setText("Cancelar"); jbtnCancelar.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jbtnCancelarActionPerformed(evt);

} }); getContentPane().add(jbtnCancelar); jbtnCancelar.setBounds(350, 510, 110, 30);

jPanel1.setBorder(javax.swing.BorderFactory.createEtchedBorder()); jPanel1.setLayout(null);

jComboBoxOpcion.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Modificacin", "Eliminacin" })); jPanel1.add(jComboBoxOpcion); jComboBoxOpcion.setBounds(90, 50, 110, 20); jPanel1.add(jtxfCodigo); jtxfCodigo.setBounds(90, 90, 200, 20); jPanel1.add(jtxfLargo); jtxfLargo.setBounds(90, 130, 200, 20); jPanel1.add(jtxfAncho); jtxfAncho.setBounds(90, 170, 200, 20); jPanel1.add(jtxfPrecio); jtxfPrecio.setBounds(90, 210, 200, 20);

jTextAreaDescripcion.setColumns(20); jTextAreaDescripcion.setRows(5); jScrollPane1.setViewportView(jTextAreaDescripcion);

jPanel1.add(jScrollPane1); jScrollPane1.setBounds(90, 260, 200, 120);

jLabel6.setText("Tipo"); jPanel1.add(jLabel6); jLabel6.setBounds(320, 120, 40, 20);

jComboBoxZona.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Jesus Mara", "Miraflores", "Surco", "Cercado de Lima", "San Miguel", "Puebo Libre", "Brea", "Chorrillos", "Santa Clara" })); jPanel1.add(jComboBoxZona); jComboBoxZona.setBounds(380, 60, 150, 20);

jLabel7.setText("Precio"); jPanel1.add(jLabel7); jLabel7.setBounds(10, 210, 60, 20);

jLabel4.setText("Ancho"); jPanel1.add(jLabel4); jLabel4.setBounds(10, 170, 60, 20);

jLabel5.setText("Largo"); jPanel1.add(jLabel5); jLabel5.setBounds(10, 130, 60, 20);

jLabel3.setText("Codigo");

jPanel1.add(jLabel3); jLabel3.setBounds(10, 90, 80, 20);

jLabel9.setText("Descripcion"); jPanel1.add(jLabel9); jLabel9.setBounds(10, 260, 70, 20);

jLabel10.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Imagenes/casas.jpg"))); // NOI18N jPanel1.add(jLabel10); jLabel10.setBounds(320, 190, 320, 222);

buttonGroupTipo.add(jradioBtnVenta); jradioBtnVenta.setText("Venta"); jPanel1.add(jradioBtnVenta); jradioBtnVenta.setBounds(370, 110, 70, 30);

buttonGroupTipo.add(jradioBtnAlquiler); jradioBtnAlquiler.setText("Alquiler"); jPanel1.add(jradioBtnAlquiler); jradioBtnAlquiler.setBounds(370, 140, 80, 30);

jLabel11.setText("Zona"); jPanel1.add(jLabel11); jLabel11.setBounds(320, 60, 40, 20);

buttonGroupDisponibilidad.add(jRadioButtonNO); jRadioButtonNO.setText("No"); jPanel1.add(jRadioButtonNO); jRadioButtonNO.setBounds(560, 140, 50, 23);

buttonGroupDisponibilidad.add(jRadioButtonSI); jRadioButtonSI.setText("Si"); jPanel1.add(jRadioButtonSI); jRadioButtonSI.setBounds(560, 110, 50, 23);

jLabel12.setText("Disponibilidad"); jPanel1.add(jLabel12); jLabel12.setBounds(470, 110, 80, 30);

getContentPane().add(jPanel1); jPanel1.setBounds(10, 60, 650, 430); }// </editor-fold>

public static void main(String[] args) { new jFrameMantenimientoCasa().setVisible(true); } private void jbtnCancelarActionPerformed(java.awt.event.ActionEvent evt) { // TODO add your handling code here: this.dispose();

jFrameMantenimientoMenu jframeMantMenu = new jFrameMantenimientoMenu(); jframeMantMenu.setLocationRelativeTo(null); jframeMantMenu.setVisible(true); }

private void jbtnAceptarActionPerformed(java.awt.event.ActionEvent evt) { // TODO add your handling code here: ArrayList<Inmueble> neoLsInmuebles = new ArrayList<Inmueble>(); String mensaje = ""; if (gestorDeInmuebles.verificaQueNoHayaCodigosRepetidos(jtxfCodigo.getText()) == false) { try { FileInputStream istream = new FileInputStream("src\\jpackArchivos\\LsInmuebles.dat"); ObjectInputStream entrada = new ObjectInputStream(istream); Inmueble inmuebleAux; while ((inmuebleAux = (Inmueble) entrada.readObject()) != null) { if (inmuebleAux.getCodigoInmueble().equals(jtxfCodigo.getText())) { if (jComboBoxOpcion.getSelectedItem().toString().equals("Modificacin")) { inmuebleAux.setLargo(Double.parseDouble(jtxfLargo.getText())); inmuebleAux.setAncho(Double.parseDouble(jtxfAncho.getText())); inmuebleAux.setPrecio(Double.parseDouble(jtxfPrecio.getText())); inmuebleAux.setDescripcion(jTextAreaDescripcion.getText()); inmuebleAux.setZona(jComboBoxZona.getSelectedItem().toString()); int tipo; if (jradioBtnAlquiler.isSelected()) {

tipo = 2; } else { tipo = 1; } inmuebleAux.setTipo(tipo); boolean disponibilidad; if(jRadioButtonSI.isSelected()){ disponibilidad=true; }else{ disponibilidad=false; } inmuebleAux.setDisponibilidad(disponibilidad); neoLsInmuebles.add(inmuebleAux); mensaje = "Modificacion exitosa"; } else { mensaje = "Eliminacion exitosa"; } } else { neoLsInmuebles.add(inmuebleAux); } } istream.close(); } catch (EOFException e) { } catch (IOException e) { UtilVista.mostrarMensajeAdvertencia("Error al leer el Archivo");

} catch (ClassNotFoundException e) { UtilVista.mostrarMensajeAdvertencia("Clase no encontrada"); } try { FileOutputStream ostream = new FileOutputStream("src\\jpackArchivos\\LsInmuebles.dat"); ObjectOutputStream salida = new ObjectOutputStream(ostream); for (int i = 0; i < neoLsInmuebles.size(); i++) { salida.writeObject(neoLsInmuebles.get(i)); ostream.flush(); } ostream.close(); } catch (EOFException e) { } catch (IOException e) { UtilVista.mostrarMensajeAdvertencia("Error al leer el Archivo"); } UtilVista.mostrarMensaje(mensaje); this.dispose(); jFrameMantenimientoMenu jframeMantMenu = new jFrameMantenimientoMenu(); jframeMantMenu.setLocationRelativeTo(null); jframeMantMenu.setVisible(true); } else { UtilVista.mostrarMensajeAdvertencia("Ingrese codigo correcto"); } }

// Variables declaration - do not modify private javax.swing.ButtonGroup buttonGroupDisponibilidad; private javax.swing.ButtonGroup buttonGroupTipo; private javax.swing.JComboBox jComboBoxOpcion; private javax.swing.JComboBox jComboBoxZona; private javax.swing.JLabel jLabel1; private javax.swing.JLabel jLabel10; private javax.swing.JLabel jLabel11; private javax.swing.JLabel jLabel12; private javax.swing.JLabel jLabel2; private javax.swing.JLabel jLabel3; private javax.swing.JLabel jLabel4; private javax.swing.JLabel jLabel5; private javax.swing.JLabel jLabel6; private javax.swing.JLabel jLabel7; private javax.swing.JLabel jLabel9; private javax.swing.JPanel jPanel1; private javax.swing.JRadioButton jRadioButtonNO; private javax.swing.JRadioButton jRadioButtonSI; private javax.swing.JScrollPane jScrollPane1; private javax.swing.JTextArea jTextAreaDescripcion; private javax.swing.JButton jbtnAceptar; private javax.swing.JButton jbtnCancelar; private javax.swing.JRadioButton jradioBtnAlquiler; private javax.swing.JRadioButton jradioBtnVenta;

private javax.swing.JTextField jtxfAncho; private javax.swing.JTextField jtxfCodigo; private javax.swing.JTextField jtxfLargo; private javax.swing.JTextField jtxfPrecio; // End of variables declaration } Clase jFrameMantenimientoDepartamento Clase jFrameMantenimientoLocal Clase jFrameMantenimientoTerreno /*Estas tres clases tendran igual implementacin que la Clase jFrameMantenimientoCasa*/

Clase jFrameMantenimientoMenu
package Vistas;

import Util.UtilVista; import javax.swing.JFrame;

public class jFrameMantenimientoMenu extends javax.swing.JFrame { public jFrameMantenimientoMenu() { initComponents(); setTitle("Sistema Inmobiliario"); setResizable(false); setSize(460, 445); setLocationRelativeTo(null); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

public static void main(String[] args) { new jFrameMantenimientoMenu().setVisible(true); } private void initComponents() {

jLabel1 = new javax.swing.JLabel(); jbtnSalir = new javax.swing.JButton(); jLabel3 = new javax.swing.JLabel(); jPanel2 = new javax.swing.JPanel(); jbtnMantDepa = new javax.swing.JButton(); jbtnMantTerreno = new javax.swing.JButton(); jbtnMantLocal = new javax.swing.JButton(); jbtnMantCasa = new javax.swing.JButton();

getContentPane().setLayout(null);

jLabel1.setForeground(new java.awt.Color(51, 0, 204)); jLabel1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Imagenes/mantenimientoMenu.png"))); // NOI18N getContentPane().add(jLabel1); jLabel1.setBounds(30, 40, 300, 90); jbtnSalir.setText("SALIR"); jbtnSalir.addActionListener(new java.awt.event.ActionListener() {

public void actionPerformed(java.awt.event.ActionEvent evt) { jbtnSalirActionPerformed(evt); } }); getContentPane().add(jbtnSalir); jbtnSalir.setBounds(210, 360, 70, 39);

jLabel3.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Imagenes/salida[1].gif"))); // NOI18N jLabel3.setText("jLabel3"); getContentPane().add(jLabel3); jLabel3.setBounds(150, 360, 44, 33);

jPanel2.setBorder(javax.swing.BorderFactory.createEtchedBorder()); jPanel2.setLayout(null);

jbtnMantDepa.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N jbtnMantDepa.setText("MANT. DEPARTAMENTO"); jbtnMantDepa.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jbtnMantDepaActionPerformed(evt); } }); jPanel2.add(jbtnMantDepa); jbtnMantDepa.setBounds(30, 80, 170, 53);

jbtnMantTerreno.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N jbtnMantTerreno.setText("MANT. TERRENO"); jbtnMantTerreno.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jbtnMantTerrenoActionPerformed(evt); } }); jPanel2.add(jbtnMantTerreno); jbtnMantTerreno.setBounds(30, 160, 170, 53);

jbtnMantLocal.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N jbtnMantLocal.setText("MANT. LOCAL"); jbtnMantLocal.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jbtnMantLocalActionPerformed(evt); } }); jPanel2.add(jbtnMantLocal); jbtnMantLocal.setBounds(230, 160, 170, 53);

jbtnMantCasa.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N jbtnMantCasa.setText("MANT. CASA"); jbtnMantCasa.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) {

jbtnMantCasaActionPerformed(evt); } }); jPanel2.add(jbtnMantCasa); jbtnMantCasa.setBounds(230, 80, 170, 52);

getContentPane().add(jPanel2); jPanel2.setBounds(10, 90, 430, 250); }// </editor-fold>

private void jbtnMantDepaActionPerformed(java.awt.event.ActionEvent evt) { // TODO add your handling code here: this.dispose(); jFrameMantenimientoDepartamento jframeMantDep = new jFrameMantenimientoDepartamento(); jframeMantDep.setLocationRelativeTo(null); jframeMantDep.setVisible(true); }

private void jbtnMantTerrenoActionPerformed(java.awt.event.ActionEvent evt) { // TODO add your handling code here: this.dispose(); jFrameMantenimientoTerreno jframeMantTerreno = new jFrameMantenimientoTerreno(); jframeMantTerreno.setLocationRelativeTo(null); jframeMantTerreno.setVisible(true);

private void jbtnMantLocalActionPerformed(java.awt.event.ActionEvent evt) { // TODO add your handling code here: this.dispose(); jFrameMantenimientoLocal jframeMantLocal = new jFrameMantenimientoLocal(); jframeMantLocal.setLocationRelativeTo(null); jframeMantLocal.setVisible(true); }

private void jbtnMantCasaActionPerformed(java.awt.event.ActionEvent evt) { // TODO add your handling code here: this.dispose(); jFrameMantenimientoCasa jframeMantCasa = new jFrameMantenimientoCasa(); jframeMantCasa.setLocationRelativeTo(null); jframeMantCasa.setVisible(true); }

private void jbtnSalirActionPerformed(java.awt.event.ActionEvent evt) { // TODO add your handling code here: this.dispose(); jFrameEntrada jframeEntrada = new jFrameEntrada(); jframeEntrada.setLocationRelativeTo(null); jframeEntrada.setVisible(true); }

// Variables declaration - do not modify private javax.swing.JLabel jLabel1; private javax.swing.JLabel jLabel3; private javax.swing.JPanel jPanel2; private javax.swing.JButton jbtnMantCasa; private javax.swing.JButton jbtnMantDepa; private javax.swing.JButton jbtnMantLocal; private javax.swing.JButton jbtnMantTerreno; private javax.swing.JButton jbtnSalir; // End of variables declaration }

Clase jFrameMostrarGanacias
Clase package Vistas;

import Entidades.BaseDatos; import Entidades.Inmueble; import Modelo.GestorDeInmuebles; import Util.UtilVista; import java.io.EOFException; import java.io.FileInputStream; import java.io.IOException; import java.io.ObjectInputStream; import java.util.ArrayList; import java.util.logging.Level;

import java.util.logging.Logger; import javax.swing.JFrame; import javax.swing.JTable;

public class jFrameMostrarGanacias extends javax.swing.JFrame { GestorDeInmuebles gestorDeInmuebles;

public jFrameMostrarGanacias() { initComponents(); gestorDeInmuebles = new GestorDeInmuebles(); setTitle("Sistema Inmobiliario"); setResizable(false); setSize(715, 715); setLocationRelativeTo(null); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); int filaAlquilados = gestorDeInmuebles.cantidadDeInmueblesAlquilados(); int filaVendidos = gestorDeInmuebles.cantidadDeInmueblesVendidos(); double totalAlquiler = 0, totalVenta = 0; //////*TABLA DE ALQUILERES*////// Object[][] objetos = new Object[filaAlquilados][3]; int indice = 0; try { ObjectInputStream entrada = new ObjectInputStream(new FileInputStream("src\\jpackArchivos\\LsInmueblesVendidosAlquilados.dat")); Inmueble A;

while ((A = (Inmueble) entrada.readObject()) != null) { if (A.getTipo() == 2) { objetos[indice][0] = A.getCodigoInmueble(); objetos[indice][1] = A.getCategoria(); objetos[indice][2] = A.getPrecio(); totalAlquiler=totalAlquiler+A.getPrecio(); indice++; if (filaAlquilados == indice) { break; } } } entrada.close();

} catch (EOFException e) { UtilVista.mostrarMensaje("Fin de Archivo"); //Mostrar mensaje de error si no se encuentra la clase } catch (ClassNotFoundException e) { UtilVista.mostrarMensajeAdvertencia("Clase no encontrada"); //Mostrar mensaje de error si no se puede leer el arcivo } catch (IOException e) { //UtilVista.mostrarMensajeAdvertencia("Error al leer el Archivo"); } String nombreDeAtributosPersonal[] = {"Cdigo", "Categoria", "Precio"}; JTable jtbTablaDeDatos = new JTable(objetos, nombreDeAtributosPersonal);

//Actualizamos el contenido del JScrollPane //Es decir ahora le decimos que muestre la nueva tabla creada jScrollPaneAlquiler.setViewportView(jtbTablaDeDatos);

//////*TABLA DE VENTAS*////// objetos = new Object[filaVendidos][3]; indice = 0; try { ObjectInputStream entrada = new ObjectInputStream(new FileInputStream("src\\jpackArchivos\\LsInmueblesVendidosAlquilados.dat")); Inmueble A; while ((A = (Inmueble) entrada.readObject()) != null) { if (A.getTipo() == 1) { objetos[indice][0] = A.getCodigoInmueble(); objetos[indice][1] = A.getCategoria(); objetos[indice][2] = A.getPrecio(); indice++; totalVenta=totalVenta+A.getPrecio(); if (filaVendidos == indice) { break; } } } entrada.close();

} catch (EOFException e) { UtilVista.mostrarMensaje("Fin de Archivo"); //Mostrar mensaje de error si no se encuentra la clase } catch (ClassNotFoundException e) { UtilVista.mostrarMensajeAdvertencia("Clase no encontrada"); //Mostrar mensaje de error si no se puede leer el arcivo } catch (IOException e) { //UtilVista.mostrarMensajeAdvertencia("Error al leer el Archivo"); } jtbTablaDeDatos = new JTable(objetos, nombreDeAtributosPersonal); //Actualizamos el contenido del JScrollPane //Es decir ahora le decimos que muestre la nueva tabla creada jScrollPaneVenta.setViewportView(jtbTablaDeDatos); jtxfTotalAlquiler.setText(""+totalAlquiler); jtxfTotalVenta.setText(""+totalVenta); jtxfTotal.setText(""+(totalAlquiler+totalVenta)); }

private void initComponents() {

jScrollPaneAlquiler = new javax.swing.JScrollPane(); jTableAlquiler = new javax.swing.JTable(); jScrollPaneVenta = new javax.swing.JScrollPane(); jTableVenta = new javax.swing.JTable(); jLabel1 = new javax.swing.JLabel();

jtxfTotal = new javax.swing.JTextField(); jbtnAceptar = new javax.swing.JButton(); jLabel2 = new javax.swing.JLabel(); jLabel3 = new javax.swing.JLabel(); jLabel4 = new javax.swing.JLabel(); jLabel5 = new javax.swing.JLabel(); jLabel6 = new javax.swing.JLabel(); jtxfTotalAlquiler = new javax.swing.JTextField(); jtxfTotalVenta = new javax.swing.JTextField(); jSeparator1 = new javax.swing.JSeparator();

setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); getContentPane().setLayout(null);

jTableAlquiler.setModel(new javax.swing.table.DefaultTableModel( new Object [][] { {null, null, null}, {null, null, null}, {null, null, null}, {null, null, null} }, new String [] { "Codigo", "Inmueble", "Precio" } ));

jScrollPaneAlquiler.setViewportView(jTableAlquiler);

getContentPane().add(jScrollPaneAlquiler); jScrollPaneAlquiler.setBounds(0, 150, 710, 120);

jTableVenta.setModel(new javax.swing.table.DefaultTableModel( new Object [][] { {null, null, null}, {null, null, null}, {null, null, null}, {null, null, null} }, new String [] { "Codigo", "Inmueble", "Precio" } )); jScrollPaneVenta.setViewportView(jTableVenta);

getContentPane().add(jScrollPaneVenta); jScrollPaneVenta.setBounds(0, 340, 710, 160);

jLabel1.setText("TOTAL"); getContentPane().add(jLabel1); jLabel1.setBounds(20, 600, 60, 20);

jtxfTotal.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jtxfTotalActionPerformed(evt); } }); getContentPane().add(jtxfTotal); jtxfTotal.setBounds(140, 600, 110, 20);

jbtnAceptar.setText("Aceptar"); jbtnAceptar.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jbtnAceptarActionPerformed(evt); } }); getContentPane().add(jbtnAceptar); jbtnAceptar.setBounds(330, 630, 80, 30);

jLabel2.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Imagenes/Ganancias.png"))); // NOI18N getContentPane().add(jLabel2); jLabel2.setBounds(220, 10, 290, 90);

jLabel3.setFont(new java.awt.Font("Comic Sans MS", 2, 20)); // NOI18N jLabel3.setText("Alquiler"); getContentPane().add(jLabel3);

jLabel3.setBounds(10, 110, 80, 30);

jLabel4.setFont(new java.awt.Font("Comic Sans MS", 2, 20)); // NOI18N jLabel4.setText("Venta"); getContentPane().add(jLabel4); jLabel4.setBounds(10, 300, 70, 30);

jLabel5.setText("TOTAL ALQUILER"); getContentPane().add(jLabel5); jLabel5.setBounds(20, 520, 100, 30);

jLabel6.setText("TOTAL VENTA"); getContentPane().add(jLabel6); jLabel6.setBounds(20, 550, 80, 30); getContentPane().add(jtxfTotalAlquiler); jtxfTotalAlquiler.setBounds(140, 530, 110, 20); getContentPane().add(jtxfTotalVenta); jtxfTotalVenta.setBounds(140, 560, 110, 20); getContentPane().add(jSeparator1); jSeparator1.setBounds(20, 590, 240, 10);

pack(); }// </editor-fold>

private void jtxfTotalActionPerformed(java.awt.event.ActionEvent evt) {

// TODO add your handling code here: }

private void jbtnAceptarActionPerformed(java.awt.event.ActionEvent evt) { // TODO add your handling code here: this.dispose(); jFrameEntrada jframeEntrada = new jFrameEntrada(); jframeEntrada.setLocationRelativeTo(null); jframeEntrada.setVisible(true);

} public static void main(String args[]) {

new jFrameMostrarGanacias().setVisible(true);

} // Variables declaration - do not modify private javax.swing.JLabel jLabel1; private javax.swing.JLabel jLabel2; private javax.swing.JLabel jLabel3; private javax.swing.JLabel jLabel4; private javax.swing.JLabel jLabel5; private javax.swing.JLabel jLabel6; private javax.swing.JScrollPane jScrollPaneAlquiler; private javax.swing.JScrollPane jScrollPaneVenta;

private javax.swing.JSeparator jSeparator1; private javax.swing.JTable jTableAlquiler; private javax.swing.JTable jTableVenta; private javax.swing.JButton jbtnAceptar; private javax.swing.JTextField jtxfTotal; private javax.swing.JTextField jtxfTotalAlquiler; private javax.swing.JTextField jtxfTotalVenta; // End of variables declaration }

Clase jFrameMostrarInmuebles
package Vistas;

import Entidades.BaseDatos; import Entidades.Inmueble; import Entidades.Personal; import Util.UtilVista; import java.io.EOFException; import java.io.FileInputStream; import java.io.IOException; import java.io.ObjectInputStream; import javax.swing.JFrame; import javax.swing.JTable; public class jFrameMostrarInmuebles extends javax.swing.JFrame { public jFrameMostrarInmuebles() throws IOException { setTitle("Sistema Inmobiliario");

setResizable(false); initComponents(); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setSize(845, 650); setLocationRelativeTo(null); int fila = BaseDatos.cantidadDeInmuebles(); Object[][] objetos = new Object[fila][7]; int indice = 0; try { ObjectInputStream entrada = new ObjectInputStream(new FileInputStream("src\\jpackArchivos\\LsInmuebles.dat")); Inmueble A; while ((A = (Inmueble) entrada.readObject()) != null) {

objetos[indice][0] = A.getCodigoInmueble(); objetos[indice][1] = A.getCategoria(); objetos[indice][2] = A.getPrecio(); objetos[indice][3] = A.getDescripcion(); objetos[indice][4] = A.getZona(); if (A.getTipo() == 1) { objetos[indice][5] = "Venta"; } else { objetos[indice][5] = "Alquiler"; } objetos[indice][6] = A.getLargo() * A.getAncho();

indice++; if (fila == indice) { break; } } entrada.close(); String nombreDeAtributosPersonal[] = {"Cdigo", "Categoria", "Precio", "Descripcin", "Zona", "Tipo", "Area"}; JTable jtbTablaDeDatos = new JTable(objetos, nombreDeAtributosPersonal); //Actualizamos el contenido del JScrollPane //Es decir ahora le decimos que muestre la nueva tabla creada jScrollPaneLsInmuebles.setViewportView(jtbTablaDeDatos); } catch (EOFException e) { UtilVista.mostrarMensaje("Fin de Archivo"); //Mostrar mensaje de error si no se encuentra la clase } catch (ClassNotFoundException e) { UtilVista.mostrarMensajeAdvertencia("Clase no encontrada"); //Mostrar mensaje de error si no se puede leer el arcivo } catch (IOException e) { UtilVista.mostrarMensajeAdvertencia("Error al leer el Archivo"); } } private void initComponents() {

jScrollPaneLsInmuebles = new javax.swing.JScrollPane();

jTableLsInmuebles = new javax.swing.JTable(); jSeparator1 = new javax.swing.JSeparator(); jLabel2 = new javax.swing.JLabel(); jbtnAceptar = new javax.swing.JButton();

setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); getContentPane().setLayout(null);

jTableLsInmuebles.setModel(new javax.swing.table.DefaultTableModel( new Object [][] { {null, null, null, null, null, null, null}, {null, null, null, null, null, null, null}, {null, null, null, null, null, null, null}, {null, null, null, null, null, null, null} }, new String [] { "Codigo", "Categoria", "Precio", "Descripcion", "Zona", "Tipo", "Area" } ){ boolean[] canEdit = new boolean [] { false, false, false, false, false, false, false };

public boolean isCellEditable(int rowIndex, int columnIndex) { return canEdit [columnIndex];

} }); jScrollPaneLsInmuebles.setViewportView(jTableLsInmuebles); jTableLsInmuebles.getColumnModel().getColumn(0).setResizable(false); jTableLsInmuebles.getColumnModel().getColumn(0).setHeaderValue("Codigo"); jTableLsInmuebles.getColumnModel().getColumn(1).setResizable(false); jTableLsInmuebles.getColumnModel().getColumn(1).setHeaderValue("Categoria"); jTableLsInmuebles.getColumnModel().getColumn(2).setResizable(false); jTableLsInmuebles.getColumnModel().getColumn(2).setHeaderValue("Precio"); jTableLsInmuebles.getColumnModel().getColumn(3).setResizable(false); jTableLsInmuebles.getColumnModel().getColumn(3).setHeaderValue("Descripcion"); jTableLsInmuebles.getColumnModel().getColumn(4).setResizable(false); jTableLsInmuebles.getColumnModel().getColumn(4).setHeaderValue("Zona"); jTableLsInmuebles.getColumnModel().getColumn(5).setResizable(false); jTableLsInmuebles.getColumnModel().getColumn(5).setHeaderValue("Tipo"); jTableLsInmuebles.getColumnModel().getColumn(6).setResizable(false); jTableLsInmuebles.getColumnModel().getColumn(6).setHeaderValue("Area");

getContentPane().add(jScrollPaneLsInmuebles); jScrollPaneLsInmuebles.setBounds(10, 100, 820, 447); getContentPane().add(jSeparator1); jSeparator1.setBounds(0, 76, 840, 10);

jLabel2.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Imagenes/listadoInmuebles.png"))); // NOI18N

getContentPane().add(jLabel2); jLabel2.setBounds(300, 10, 260, 50);

jbtnAceptar.setText("Aceptar"); jbtnAceptar.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jbtnAceptarActionPerformed(evt); } }); getContentPane().add(jbtnAceptar); jbtnAceptar.setBounds(390, 560, 90, 40);

pack(); }// </editor-fold>

private void jbtnAceptarActionPerformed(java.awt.event.ActionEvent evt) { // TODO add your handling code here: this.dispose(); jFrameEntrada jFrameEntrada = new jFrameEntrada(); jFrameEntrada.setLocationRelativeTo(null); jFrameEntrada.setVisible(true); } public static void main(String args[]) throws IOException { new jFrameMostrarInmuebles().setVisible(true); }

// Variables declaration - do not modify private javax.swing.JLabel jLabel2; private javax.swing.JScrollPane jScrollPaneLsInmuebles; private javax.swing.JSeparator jSeparator1; private javax.swing.JTable jTableLsInmuebles; private javax.swing.JButton jbtnAceptar; // End of variables declaration }

Clase jFrameRegistroPersonal
package Vistas;

import Entidades.Personal; import Modelo.GestorDePersonal; import Util.UtilVista; import java.awt.event.KeyEvent; import java.awt.event.KeyListener; import java.io.IOException; import java.text.ParseException; import java.util.logging.Level; import java.util.logging.Logger; import javax.swing.JFrame; import javax.swing.JOptionPane; public class jFrameRegistroPersonal extends javax.swing.JFrame { private GestorDePersonal gestorDePersonal;

public jFrameRegistroPersonal() { gestorDePersonal = new GestorDePersonal(); initComponents(); setTitle("Sistema Inmobiliario"); setResizable(false); setSize(605, 600); setLocationRelativeTo(null); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); jtxfApPaterno.addKeyListener(new KeyListener() { public void keyTyped(KeyEvent e) { char c = e.getKeyChar(); if (!Character.isLetter(c) && c != KeyEvent.VK_SPACE && c != KeyEvent.VK_BACK_SPACE) { e.consume(); } }

@Override public void keyPressed(KeyEvent e) { }

@Override public void keyReleased(KeyEvent e) { }

}); jtxfApMaterno.addKeyListener(new KeyListener() { public void keyTyped(KeyEvent e) { char c = e.getKeyChar(); if (!Character.isLetter(c) && c != KeyEvent.VK_SPACE && c != KeyEvent.VK_BACK_SPACE) { e.consume(); } }

@Override public void keyPressed(KeyEvent e) { }

@Override public void keyReleased(KeyEvent e) { } }); jtxfNombre.addKeyListener(new KeyListener() { public void keyTyped(KeyEvent e) { char c = e.getKeyChar(); if (!Character.isLetter(c) && c != KeyEvent.VK_SPACE && c != KeyEvent.VK_BACK_SPACE) { e.consume(); } }

@Override public void keyPressed(KeyEvent e) { } @Override public void keyReleased(KeyEvent e) { } }); }

public boolean comprobarQueNoHayaEspaciosVacios() { if (jtxfCodigo.getText().equals("") || jtxfApPaterno.getText().equals("") || jtxfApMaterno.getText().equals("") || jtxfNombre.getText().equals("") || jFormatedTxfDni.getText().equals("") || jFormatedTxfCelular.getText().equals("") || jtxfCodigo.getText().equals("") || jtxfPassword.getText().equals("")) { UtilVista.mostrarMensajeAdvertencia("Complete todos los datos"); return false; } else { return true; } }

public static void main(String[] args) { new jFrameRegistroPersonal().setVisible(true);

private void initComponents() {

jLabel7 = new javax.swing.JLabel(); jtxfApPaterno = new javax.swing.JTextField(); jLabel8 = new javax.swing.JLabel(); jLabel9 = new javax.swing.JLabel(); jcmbxDia = new javax.swing.JComboBox(); jcmbxMes = new javax.swing.JComboBox(); jtxfApMaterno = new javax.swing.JTextField(); jcmbxAnio = new javax.swing.JComboBox(); jLabel12 = new javax.swing.JLabel(); jLabel11 = new javax.swing.JLabel(); jLabel13 = new javax.swing.JLabel(); jtxfCodigo = new javax.swing.JTextField(); jLabel3 = new javax.swing.JLabel(); jtxfPassword = new javax.swing.JTextField(); jLabel4 = new javax.swing.JLabel(); jbtnRegistrar = new javax.swing.JButton();

jcmbxCategoria = new javax.swing.JComboBox(); jbtnCancelar = new javax.swing.JButton(); jLabel15 = new javax.swing.JLabel(); jLabel14 = new javax.swing.JLabel(); jtxfNombre = new javax.swing.JTextField(); jLabel1 = new javax.swing.JLabel(); jLabel5 = new javax.swing.JLabel(); jLabel6 = new javax.swing.JLabel(); jLabel2 = new javax.swing.JLabel(); jPanel1 = new javax.swing.JPanel(); jFormatedTxfDni = new javax.swing.JFormattedTextField(); jFormatedTxfCelular = new javax.swing.JFormattedTextField(); jLabel10 = new javax.swing.JLabel();

getContentPane().setLayout(null);

jLabel7.setText("Fecha de nacimiento"); getContentPane().add(jLabel7); jLabel7.setBounds(30, 340, 120, 20); getContentPane().add(jtxfApPaterno); jtxfApPaterno.setBounds(170, 130, 200, 20);

jLabel8.setText("Cdigo"); getContentPane().add(jLabel8); jLabel8.setBounds(30, 380, 70, 20);

jLabel9.setText("Password"); getContentPane().add(jLabel9); jLabel9.setBounds(30, 420, 70, 20);

jcmbxDia.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23", "24", "25", "26", "27", "28", "29", "30", "31" })); jcmbxDia.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jcmbxDiaActionPerformed(evt); } }); getContentPane().add(jcmbxDia); jcmbxDia.setBounds(200, 340, 37, 20);

jcmbxMes.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12" })); getContentPane().add(jcmbxMes); jcmbxMes.setBounds(300, 340, 40, 20); getContentPane().add(jtxfApMaterno); jtxfApMaterno.setBounds(170, 170, 200, 20);

jcmbxAnio.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "1980", "1981", "1982", "1983", "1984", "1985", "1986", "1987", "1988", "1989", "1990", "1991" })); getContentPane().add(jcmbxAnio);

jcmbxAnio.setBounds(400, 340, 60, 20);

jLabel12.setText("Mes"); getContentPane().add(jLabel12); jLabel12.setBounds(270, 340, 50, 20);

jLabel11.setText("Da"); getContentPane().add(jLabel11); jLabel11.setBounds(170, 340, 40, 20);

jLabel13.setText("Ao"); getContentPane().add(jLabel13); jLabel13.setBounds(370, 340, 50, 20); getContentPane().add(jtxfCodigo); jtxfCodigo.setBounds(170, 380, 200, 20);

jLabel3.setText("DATOS PERSONALES"); getContentPane().add(jLabel3); jLabel3.setBounds(30, 100, 140, 20); getContentPane().add(jtxfPassword); jtxfPassword.setBounds(170, 420, 200, 20);

jLabel4.setText("Ap. Paterno"); getContentPane().add(jLabel4); jLabel4.setBounds(30, 130, 100, 30);

jbtnRegistrar.setText("REGISTRAR"); jbtnRegistrar.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jbtnRegistrarActionPerformed(evt); } }); getContentPane().add(jbtnRegistrar); jbtnRegistrar.setBounds(170, 520, 120, 30);

jcmbxCategoria.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Administrador", "Vendedor" })); jcmbxCategoria.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jcmbxCategoriaActionPerformed(evt); } }); getContentPane().add(jcmbxCategoria); jcmbxCategoria.setBounds(170, 460, 110, 20);

jbtnCancelar.setText("CANCELAR"); jbtnCancelar.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jbtnCancelarActionPerformed(evt); }

}); getContentPane().add(jbtnCancelar); jbtnCancelar.setBounds(310, 520, 110, 30);

jLabel15.setText("Categoria"); getContentPane().add(jLabel15); jLabel15.setBounds(30, 460, 70, 20);

jLabel14.setText("Nombres"); getContentPane().add(jLabel14); jLabel14.setBounds(30, 210, 70, 30);

jtxfNombre.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jtxfNombreActionPerformed(evt); } }); getContentPane().add(jtxfNombre); jtxfNombre.setBounds(170, 210, 200, 20);

jLabel1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Imagenes/packiconos[1].jpg"))); // NOI18N jLabel1.setPreferredSize(new java.awt.Dimension(107, 109)); getContentPane().add(jLabel1); jLabel1.setBounds(450, 130, 107, 120);

jLabel5.setText("Ap. Materno"); getContentPane().add(jLabel5); jLabel5.setBounds(30, 170, 90, 20);

jLabel6.setText("DNI"); getContentPane().add(jLabel6); jLabel6.setBounds(30, 250, 40, 30);

jLabel2.setFont(new java.awt.Font("Tahoma", 0, 14)); // NOI18N jLabel2.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Imagenes/registrarPersonal.png"))); // NOI18N getContentPane().add(jLabel2); jLabel2.setBounds(40, 20, 297, 48);

jPanel1.setBorder(javax.swing.BorderFactory.createEtchedBorder()); jPanel1.setLayout(null);

try { jFormatedTxfDni.setFormatterFactory(new javax.swing.text.DefaultFormatterFactory(new javax.swing.text.MaskFormatter("########"))); } catch (java.text.ParseException ex) { ex.printStackTrace(); } jFormatedTxfDni.addActionListener(new java.awt.event.ActionListener() {

public void actionPerformed(java.awt.event.ActionEvent evt) { jFormatedTxfDniActionPerformed(evt); } }); jPanel1.add(jFormatedTxfDni); jFormatedTxfDni.setBounds(160, 210, 200, 20);

try { jFormatedTxfCelular.setFormatterFactory(new javax.swing.text.DefaultFormatterFactory(new javax.swing.text.MaskFormatter("#########"))); } catch (java.text.ParseException ex) { ex.printStackTrace(); } jPanel1.add(jFormatedTxfCelular); jFormatedTxfCelular.setBounds(160, 250, 200, 20);

jLabel10.setText("Celular"); jPanel1.add(jLabel10); jLabel10.setBounds(20, 250, 60, 30);

getContentPane().add(jPanel1); jPanel1.setBounds(10, 40, 580, 460); }// </editor-fold>

private void jcmbxDiaActionPerformed(java.awt.event.ActionEvent evt) {

// TODO add your handling code here: }

private void jcmbxCategoriaActionPerformed(java.awt.event.ActionEvent evt) { // TODO add your handling code here: }

private void jtxfNombreActionPerformed(java.awt.event.ActionEvent evt) { // TODO add your handling code here: }

private void jbtnRegistrarActionPerformed(java.awt.event.ActionEvent evt) { // TODO add your handling code here: if (comprobarQueNoHayaEspaciosVacios()) { Personal personal = new Personal(); personal.setApePaterno(jtxfApPaterno.getText()); personal.setApeMaterno(jtxfApMaterno.getText()); personal.setNombres(jtxfNombre.getText()); personal.setDni(jFormatedTxfDni.getText()); personal.setDia(Integer.parseInt(jcmbxDia.getSelectedItem().toString())); personal.setMes(Integer.parseInt(jcmbxMes.getSelectedItem().toString())); personal.setAnio(Integer.parseInt(jcmbxAnio.getSelectedItem().toString())); personal.setCodigoPersonal(jtxfCodigo.getText()); personal.setPassword(jtxfPassword.getText()); personal.setCategoriaPersonal(jcmbxCategoria.getSelectedItem().toString());

if (gestorDePersonal.verificaQueNoHayaCodigosRepetidos(personal.getCodigoPersonal())) { gestorDePersonal.aadirArchivo(personal); this.dispose(); jFrameEntrada jframeEntrada = new jFrameEntrada(); jframeEntrada.setLocationRelativeTo(null); jframeEntrada.setVisible(true); } else { jtxfCodigo.setText(""); UtilVista.mostrarMensajeAdvertencia("Codigo ya registrado"); } }

private void jbtnCancelarActionPerformed(java.awt.event.ActionEvent evt) { // TODO add your handling code here: this.dispose(); jFrameRegistrarMenu jframeRegistrarMenu = new jFrameRegistrarMenu(); jframeRegistrarMenu.setLocationRelativeTo(null); jframeRegistrarMenu.setVisible(true); }

private void jFormatedTxfDniActionPerformed(java.awt.event.ActionEvent evt) { // TODO add your handling code here:

} // Variables declaration - do not modify private javax.swing.JFormattedTextField jFormatedTxfCelular; private javax.swing.JFormattedTextField jFormatedTxfDni; private javax.swing.JLabel jLabel1; private javax.swing.JLabel jLabel10; private javax.swing.JLabel jLabel11; private javax.swing.JLabel jLabel12; private javax.swing.JLabel jLabel13; private javax.swing.JLabel jLabel14; private javax.swing.JLabel jLabel15; private javax.swing.JLabel jLabel2; private javax.swing.JLabel jLabel3; private javax.swing.JLabel jLabel4; private javax.swing.JLabel jLabel5; private javax.swing.JLabel jLabel6; private javax.swing.JLabel jLabel7; private javax.swing.JLabel jLabel8; private javax.swing.JLabel jLabel9; private javax.swing.JPanel jPanel1; private javax.swing.JButton jbtnCancelar; private javax.swing.JButton jbtnRegistrar; private javax.swing.JComboBox jcmbxAnio; private javax.swing.JComboBox jcmbxCategoria; private javax.swing.JComboBox jcmbxDia;

private javax.swing.JComboBox jcmbxMes; private javax.swing.JTextField jtxfApMaterno; private javax.swing.JTextField jtxfApPaterno; private javax.swing.JTextField jtxfCodigo; private javax.swing.JTextField jtxfNombre; private javax.swing.JTextField jtxfPassword; // End of variables declaration }

Paquete ProgramaPrincipal: este paquete contiene la mtodo main, con el cual comenzara a correr nuestro programa
package ProgramaPrincipal; import Entidades.BaseDatos; import Util.UtilVista; import Vistas.jFrameIniciarSesion; import javax.swing.JFrame; public class ProgramaPrincipal {

public static void main(String[] args) { new jFrameIniciarSesion().setVisible(true); } }

CONCLUSIONES La elaboracin de este proyecto ha servido para afianzar y poner en prctica muchos de los conocimientos aprendidos a lo largo del curso. Principalmente se han tratado de poner en prctica los temas vistos hasta el momento aplicacin de Algoritmia en muchos de los mtodos. Tambin se ha podido afianzar y desarrollar los conocimientos adquiridos en cuanto a planificacin y gestin de proyectos. Por otro lado, se puede considerar que se han cumplido los objetivos propuestos antes de comenzarlo, desarrollando un sistema que cumple con todos los requisitos y adquiriendo un gran conocimiento y familiarizacin no slo con las ltimas tecnologas en cuanto a desarrollo de software sino tambin con tcnicas adecuadas de diseo y programacin.

Anda mungkin juga menyukai