├── dist ├── Biblioteca.jar ├── lib │ └── mysql-connector-java-5.1.23-bin.jar └── README.TXT ├── imagens ├── modelagem.png ├── tela-livros.png ├── tela-multas.png ├── tela-clientes.png ├── tela-inicial.png └── tela-emprestimos.png ├── nbproject ├── private │ ├── private.properties │ └── private.xml ├── genfiles.properties ├── project.xml └── project.properties ├── src ├── utils │ ├── imagens │ │ └── antique-library-302930.jpg │ ├── CriaConexao.java │ ├── BdCliente.java │ ├── BdLivro.java │ ├── BdEmprestimo.java │ └── BdMulta.java ├── view │ ├── Biblioteca.java │ ├── JFPrincipal.form │ ├── JFPrincipal.java │ ├── JFLivro.form │ ├── JFCliente.form │ ├── JFMulta.form │ ├── JFEmprestimo.form │ ├── JFLivro.java │ └── JFCliente.java └── model │ ├── Multa.java │ ├── Livro.java │ ├── Emprestimo.java │ └── Cliente.java └── README.md /dist/Biblioteca.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/paulojp-dev/projeto-biblioteca-java/HEAD/dist/Biblioteca.jar -------------------------------------------------------------------------------- /imagens/modelagem.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/paulojp-dev/projeto-biblioteca-java/HEAD/imagens/modelagem.png -------------------------------------------------------------------------------- /imagens/tela-livros.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/paulojp-dev/projeto-biblioteca-java/HEAD/imagens/tela-livros.png -------------------------------------------------------------------------------- /imagens/tela-multas.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/paulojp-dev/projeto-biblioteca-java/HEAD/imagens/tela-multas.png -------------------------------------------------------------------------------- /imagens/tela-clientes.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/paulojp-dev/projeto-biblioteca-java/HEAD/imagens/tela-clientes.png -------------------------------------------------------------------------------- /imagens/tela-inicial.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/paulojp-dev/projeto-biblioteca-java/HEAD/imagens/tela-inicial.png -------------------------------------------------------------------------------- /imagens/tela-emprestimos.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/paulojp-dev/projeto-biblioteca-java/HEAD/imagens/tela-emprestimos.png -------------------------------------------------------------------------------- /nbproject/private/private.properties: -------------------------------------------------------------------------------- 1 | compile.on.save=true 2 | user.properties.file=/home/paulojp/.netbeans/8.0.2/build.properties 3 | -------------------------------------------------------------------------------- /dist/lib/mysql-connector-java-5.1.23-bin.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/paulojp-dev/projeto-biblioteca-java/HEAD/dist/lib/mysql-connector-java-5.1.23-bin.jar -------------------------------------------------------------------------------- /src/utils/imagens/antique-library-302930.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/paulojp-dev/projeto-biblioteca-java/HEAD/src/utils/imagens/antique-library-302930.jpg -------------------------------------------------------------------------------- /nbproject/private/private.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /nbproject/genfiles.properties: -------------------------------------------------------------------------------- 1 | build.xml.data.CRC32=30e96a0e 2 | build.xml.script.CRC32=c9034694 3 | build.xml.stylesheet.CRC32=8064a381@1.75.2.48 4 | # This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml. 5 | # Do not edit this file. You may delete it but then the IDE will never regenerate such files for you. 6 | nbproject/build-impl.xml.data.CRC32=30e96a0e 7 | nbproject/build-impl.xml.script.CRC32=6c221748 8 | nbproject/build-impl.xml.stylesheet.CRC32=876e7a8f@1.75.2.48 9 | -------------------------------------------------------------------------------- /nbproject/project.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | org.netbeans.modules.java.j2seproject 4 | 5 | 6 | Biblioteca 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /src/view/Biblioteca.java: -------------------------------------------------------------------------------- 1 | /* 2 | * To change this license header, choose License Headers in Project Properties. 3 | * To change this template file, choose Tools | Templates 4 | * and open the template in the editor. 5 | */ 6 | package view; 7 | 8 | import java.sql.SQLException; 9 | import java.text.ParseException; 10 | /** 11 | * 12 | * @author paulojp 13 | */ 14 | public class Biblioteca { 15 | 16 | /** 17 | * @param args the command line arguments 18 | * @throws java.sql.SQLException 19 | * @throws java.text.ParseException 20 | */ 21 | public static void main(String[] args) throws SQLException, ParseException { 22 | 23 | JFPrincipal principal = new JFPrincipal(); 24 | principal.setVisible(true); 25 | 26 | } 27 | 28 | } 29 | -------------------------------------------------------------------------------- /src/utils/CriaConexao.java: -------------------------------------------------------------------------------- 1 | /* 2 | * To change this license header, choose License Headers in Project Properties. 3 | * To change this template file, choose Tools | Templates 4 | * and open the template in the editor. 5 | */ 6 | package utils; 7 | 8 | import java.sql.Connection; 9 | import java.sql.DriverManager; 10 | import java.sql.SQLException; 11 | 12 | /** 13 | * 14 | * @author paulojp 15 | */ 16 | public class CriaConexao { 17 | 18 | public static Connection getConexao() throws SQLException { 19 | 20 | try { 21 | Class.forName("com.mysql.jdbc.Driver"); 22 | System.out.println("Conectando ao banco de dados."); 23 | return DriverManager.getConnection("jdbc:mysql://localhost/biblioteca", "root", "P9544504"); 24 | } catch (ClassNotFoundException e) { 25 | throw new SQLException(e.getMessage()); 26 | } 27 | 28 | } 29 | 30 | } 31 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Projeto Biblioteca em Java Desktop 2 | 3 | Software para biblioteca em java, simples. O sistema contém somente as funcionalidades básicas, desenvolvido a fim de obter nota para a matéria de Programação OO do 3ª período de Análise e Desenvolvimento de Sistemas. 4 | 5 | --- 6 | 7 | **Author:** João Paulo Ferreira da Silva (PauloJP) 8 | 9 | **Data:** 06/2015 10 | 11 | # Tecnologias Utilizadas: 12 | - **Netbeans** como IDE 13 | - **Java 7** 14 | 15 | # Modelagem 16 | 17 | 18 | ## Telas 19 | ### Tela Inicial 20 | 21 | 22 | ### Tela Edição de Clientes 23 | 24 | 25 | ### Tela Edição de Livros 26 | 27 | 28 | ### Tela Edição de Empréstimos 29 | 30 | 31 | ### Tela Edição de Multas 32 | 33 | -------------------------------------------------------------------------------- /dist/README.TXT: -------------------------------------------------------------------------------- 1 | ======================== 2 | BUILD OUTPUT DESCRIPTION 3 | ======================== 4 | 5 | When you build an Java application project that has a main class, the IDE 6 | automatically copies all of the JAR 7 | files on the projects classpath to your projects dist/lib folder. The IDE 8 | also adds each of the JAR files to the Class-Path element in the application 9 | JAR files manifest file (MANIFEST.MF). 10 | 11 | To run the project from the command line, go to the dist folder and 12 | type the following: 13 | 14 | java -jar "Biblioteca.jar" 15 | 16 | To distribute this project, zip up the dist folder (including the lib folder) 17 | and distribute the ZIP file. 18 | 19 | Notes: 20 | 21 | * If two JAR files on the project classpath have the same name, only the first 22 | JAR file is copied to the lib folder. 23 | * Only JAR files are copied to the lib folder. 24 | If the classpath contains other types of files or folders, these files (folders) 25 | are not copied. 26 | * If a library on the projects classpath also has a Class-Path element 27 | specified in the manifest,the content of the Class-Path element has to be on 28 | the projects runtime path. 29 | * To set a main class in a standard Java project, right-click the project node 30 | in the Projects window and choose Properties. Then click Run and enter the 31 | class name in the Main Class field. Alternatively, you can manually type the 32 | class name in the manifest Main-Class element. 33 | -------------------------------------------------------------------------------- /src/model/Multa.java: -------------------------------------------------------------------------------- 1 | /* 2 | * To change this license header, choose License Headers in Project Properties. 3 | * To change this template file, choose Tools | Templates 4 | * and open the template in the editor. 5 | */ 6 | package model; 7 | 8 | /** 9 | * 10 | * @author paulojp 11 | */ 12 | public class Multa { 13 | private int id_multa; 14 | private int id_cliente; 15 | private String descricao; 16 | private float valor; 17 | 18 | public Multa(int id_multa, int id_emprestimo, String descricao, float valor, String pagamento) { 19 | this.id_multa = id_multa; 20 | this.id_cliente = id_emprestimo; 21 | this.descricao = descricao; 22 | this.valor = valor; 23 | } 24 | 25 | public Multa() { 26 | } 27 | 28 | public int getId_multa() { 29 | return id_multa; 30 | } 31 | 32 | public void setId_multa(int id_multa) { 33 | this.id_multa = id_multa; 34 | } 35 | 36 | public int getId_cliente() { 37 | return id_cliente; 38 | } 39 | 40 | public void setId_cliente(int id_cliente) { 41 | this.id_cliente = id_cliente; 42 | } 43 | 44 | public String getDescricao() { 45 | return descricao; 46 | } 47 | 48 | public void setDescricao(String descricao) { 49 | this.descricao = descricao; 50 | } 51 | 52 | public float getValor() { 53 | return valor; 54 | } 55 | 56 | public void setValor(float valor) { 57 | this.valor = valor; 58 | } 59 | 60 | } 61 | -------------------------------------------------------------------------------- /src/model/Livro.java: -------------------------------------------------------------------------------- 1 | /* 2 | * To change this license header, choose License Headers in Project Properties. 3 | * To change this template file, choose Tools | Templates 4 | * and open the template in the editor. 5 | */ 6 | package model; 7 | 8 | /** 9 | * 10 | * @author paulojp 11 | */ 12 | public class Livro { 13 | 14 | private int id; 15 | private String exemplar; 16 | private String autor; 17 | private byte edicao; 18 | private short ano; 19 | private String disponibilidade; 20 | 21 | public Livro(int id, String exemplar, String autor, byte edicao, short ano, String disponibilidade) { 22 | this.id = id; 23 | this.exemplar = exemplar; 24 | this.autor = autor; 25 | this.edicao = edicao; 26 | this.ano = ano; 27 | this.disponibilidade = disponibilidade; 28 | } 29 | 30 | public Livro() { 31 | } 32 | 33 | public int getId() { 34 | return id; 35 | } 36 | 37 | public void setId(int id) { 38 | this.id = id; 39 | } 40 | 41 | public String getExemplar() { 42 | return exemplar; 43 | } 44 | 45 | public void setExemplar(String exemplar) { 46 | this.exemplar = exemplar; 47 | } 48 | 49 | public String getAutor() { 50 | return autor; 51 | } 52 | 53 | public void setAutor(String autor) { 54 | this.autor = autor; 55 | } 56 | 57 | public byte getEdicao() { 58 | return edicao; 59 | } 60 | 61 | public void setEdicao(byte edicao) { 62 | this.edicao = edicao; 63 | } 64 | 65 | public short getAno() { 66 | return ano; 67 | } 68 | 69 | public void setAno(short ano) { 70 | this.ano = ano; 71 | } 72 | 73 | public String getDisponibilidade() { 74 | return disponibilidade; 75 | } 76 | 77 | public void setDisponibilidade(String disponibilidade) { 78 | this.disponibilidade = disponibilidade; 79 | } 80 | } 81 | -------------------------------------------------------------------------------- /src/model/Emprestimo.java: -------------------------------------------------------------------------------- 1 | /* 2 | * To change this license header, choose License Headers in Project Properties. 3 | * To change this template file, choose Tools | Templates 4 | * and open the template in the editor. 5 | */ 6 | package model; 7 | 8 | /** 9 | * 10 | * @author paulojp 11 | */ 12 | public class Emprestimo { 13 | 14 | private int id_emprestimo; 15 | private int id_cliente; 16 | private int id_livro; 17 | private String data_emprestimo; 18 | private String data_devolucao; 19 | 20 | public Emprestimo() { 21 | } 22 | 23 | public Emprestimo(int id_emprestimo, int id_cliente, int id_livro, String data_emprestimo, String data_devolucao) { 24 | this.id_emprestimo = id_emprestimo; 25 | this.id_cliente = id_cliente; 26 | this.id_livro = id_livro; 27 | this.data_emprestimo = data_emprestimo; 28 | this.data_devolucao = data_devolucao; 29 | } 30 | 31 | public int getId_emprestimo() { 32 | return id_emprestimo; 33 | } 34 | 35 | public void setId_emprestimo(int id_emprestimo) { 36 | this.id_emprestimo = id_emprestimo; 37 | } 38 | 39 | public int getId_cliente() { 40 | return id_cliente; 41 | } 42 | 43 | public void setId_cliente(int id_cliente) { 44 | this.id_cliente = id_cliente; 45 | } 46 | 47 | public int getId_livro() { 48 | return id_livro; 49 | } 50 | 51 | public void setId_livro(int id_livro) { 52 | this.id_livro = id_livro; 53 | } 54 | 55 | public String getData_emprestimo() { 56 | return data_emprestimo; 57 | } 58 | 59 | public void setData_emprestimo(String data_emprestimo) { 60 | this.data_emprestimo = data_emprestimo; 61 | } 62 | 63 | public String getData_devolucao() { 64 | return data_devolucao; 65 | } 66 | 67 | public void setData_devolucao(String data_devolucao) { 68 | this.data_devolucao = data_devolucao; 69 | } 70 | 71 | } 72 | -------------------------------------------------------------------------------- /src/model/Cliente.java: -------------------------------------------------------------------------------- 1 | /* 2 | * To change this license header, choose License Headers in Project Properties. 3 | * To change this template file, choose Tools | Templates 4 | * and open the template in the editor. 5 | */ 6 | package model; 7 | 8 | /** 9 | * 10 | * @author paulojp 11 | */ 12 | public class Cliente { 13 | 14 | private int id; 15 | private String nome; 16 | private String dataNasc; 17 | private String sexo; 18 | private String cpf; 19 | private String endereco; 20 | private String fone; 21 | 22 | public Cliente(String nome, String dataNasc, String sexo, String cpf, String endereco, String fone) { 23 | this.nome = nome; 24 | this.dataNasc = dataNasc; 25 | this.sexo = sexo; 26 | this.cpf = cpf; 27 | this.endereco = endereco; 28 | this.fone = fone; 29 | } 30 | 31 | public Cliente() { 32 | } 33 | 34 | public int getId() { 35 | return id; 36 | } 37 | 38 | public void setId(int id) { 39 | this.id = id; 40 | } 41 | 42 | public String getNome() { 43 | return nome; 44 | } 45 | 46 | public void setNome(String nome) { 47 | this.nome = nome; 48 | } 49 | 50 | public String getDataNasc() { 51 | return dataNasc; 52 | } 53 | 54 | public void setDataNasc(String dataNasc) { 55 | this.dataNasc = dataNasc; 56 | } 57 | 58 | public String getSexo() { 59 | return sexo; 60 | } 61 | 62 | public void setSexo(String sexo) { 63 | this.sexo = sexo; 64 | } 65 | 66 | public String getCpf() { 67 | return cpf; 68 | } 69 | 70 | public void setCpf(String cpf) { 71 | this.cpf = cpf; 72 | } 73 | 74 | public String getEndereco() { 75 | return endereco; 76 | } 77 | 78 | public void setEndereco(String endereco) { 79 | this.endereco = endereco; 80 | } 81 | 82 | public String getFone() { 83 | return fone; 84 | } 85 | 86 | public void setFone(String fone) { 87 | this.fone = fone; 88 | } 89 | 90 | } 91 | -------------------------------------------------------------------------------- /nbproject/project.properties: -------------------------------------------------------------------------------- 1 | annotation.processing.enabled=true 2 | annotation.processing.enabled.in.editor=false 3 | annotation.processing.processor.options= 4 | annotation.processing.processors.list= 5 | annotation.processing.run.all.processors=true 6 | annotation.processing.source.output=${build.generated.sources.dir}/ap-source-output 7 | build.classes.dir=${build.dir}/classes 8 | build.classes.excludes=**/*.java,**/*.form 9 | # This directory is removed when the project is cleaned: 10 | build.dir=build 11 | build.generated.dir=${build.dir}/generated 12 | build.generated.sources.dir=${build.dir}/generated-sources 13 | # Only compile against the classpath explicitly listed here: 14 | build.sysclasspath=ignore 15 | build.test.classes.dir=${build.dir}/test/classes 16 | build.test.results.dir=${build.dir}/test/results 17 | # Uncomment to specify the preferred debugger connection transport: 18 | #debug.transport=dt_socket 19 | debug.classpath=\ 20 | ${run.classpath} 21 | debug.test.classpath=\ 22 | ${run.test.classpath} 23 | # Os arquivos em build.classes.dir que devem ser exclu\u00eddos do jar de distribui\u00e7\u00e3o 24 | dist.archive.excludes= 25 | # This directory is removed when the project is cleaned: 26 | dist.dir=dist 27 | dist.jar=${dist.dir}/Biblioteca.jar 28 | dist.javadoc.dir=${dist.dir}/javadoc 29 | excludes= 30 | includes=** 31 | jar.compress=false 32 | javac.classpath=\ 33 | ${libs.MySQLDriver.classpath} 34 | # Space-separated list of extra javac options 35 | javac.compilerargs= 36 | javac.deprecation=false 37 | javac.processorpath=\ 38 | ${javac.classpath} 39 | javac.source=1.8 40 | javac.target=1.8 41 | javac.test.classpath=\ 42 | ${javac.classpath}:\ 43 | ${build.classes.dir} 44 | javac.test.processorpath=\ 45 | ${javac.test.classpath} 46 | javadoc.additionalparam= 47 | javadoc.author=false 48 | javadoc.encoding=${source.encoding} 49 | javadoc.noindex=false 50 | javadoc.nonavbar=false 51 | javadoc.notree=false 52 | javadoc.private=false 53 | javadoc.splitindex=true 54 | javadoc.use=true 55 | javadoc.version=false 56 | javadoc.windowtitle= 57 | main.class=view.Biblioteca 58 | manifest.file=manifest.mf 59 | meta.inf.dir=${src.dir}/META-INF 60 | mkdist.disabled=false 61 | platform.active=default_platform 62 | run.classpath=\ 63 | ${javac.classpath}:\ 64 | ${build.classes.dir} 65 | # Space-separated list of JVM arguments used when running the project. 66 | # You may also define separate properties like run-sys-prop.name=value instead of -Dname=value. 67 | # To set system properties for unit tests define test-sys-prop.name=value: 68 | run.jvmargs= 69 | run.test.classpath=\ 70 | ${javac.test.classpath}:\ 71 | ${build.test.classes.dir} 72 | source.encoding=UTF-8 73 | src.dir=src 74 | test.src.dir=test 75 | -------------------------------------------------------------------------------- /src/utils/BdCliente.java: -------------------------------------------------------------------------------- 1 | /* 2 | * To change this license header, choose License Headers in Project Properties. 3 | * To change this template file, choose Tools | Templates 4 | * and open the template in the editor. 5 | */ 6 | package utils; 7 | 8 | import java.sql.Connection; 9 | import java.sql.PreparedStatement; 10 | import java.sql.ResultSet; 11 | import java.sql.SQLException; 12 | import java.util.ArrayList; 13 | import java.util.List; 14 | import model.Cliente; 15 | 16 | /** 17 | * 18 | * @author paulojp 19 | */ 20 | public class BdCliente { 21 | 22 | /* ----CONEXÃO COM O BD-> */ 23 | private Connection conexao; 24 | 25 | // Estabelece uma conexão 26 | public BdCliente() throws SQLException { 27 | this.conexao = CriaConexao.getConexao(); 28 | } 29 | /* <-CONEXÃO COM O BD---- */ 30 | 31 | 32 | 33 | 34 | /* ----CLIENTE-> */ 35 | 36 | // CREATE - Adiciona um registro 37 | public void adicionaCliente(Cliente c) throws SQLException { 38 | // Prepara conexão p/ receber o comando SQL 39 | String sql = "INSERT INTO cliente(nome, data_nasc, sexo, cpf, endereco, fone)" 40 | + "VALUES(?, ?, ?, ?, ?, ?)"; 41 | PreparedStatement stmt; 42 | // stmt recebe o comando SQL 43 | stmt = this.conexao.prepareStatement(sql); 44 | 45 | // Seta os valores p/ o stmt, substituindo os "?" 46 | stmt.setString(1, c.getNome()); 47 | stmt.setString(2, c.getDataNasc()); 48 | stmt.setString(3, c.getSexo()); 49 | stmt.setString(4, c.getCpf()); 50 | stmt.setString(5, c.getEndereco()); 51 | stmt.setString(6, c.getFone()); 52 | 53 | // O stmt executa o comando SQL no BD, e fecha a conexão 54 | stmt.execute(); 55 | stmt.close(); 56 | 57 | } 58 | 59 | // SELECT - Retorna uma lista com o resultado da consulta 60 | public List getLista(String nome) throws SQLException{ 61 | // Prepara conexão p/ receber o comando SQL 62 | String sql = "SELECT * FROM cliente WHERE nome like ?"; 63 | PreparedStatement stmt = this.conexao.prepareStatement(sql); 64 | stmt.setString(1, nome); 65 | 66 | // Recebe o resultado da consulta SQL 67 | ResultSet rs = stmt.executeQuery(); 68 | 69 | List lista = new ArrayList<>(); 70 | 71 | // Enquanto existir registros, pega os valores do ReultSet e vai adicionando na lista 72 | while(rs.next()) { 73 | // A cada loop, é instanciado um novo objeto, p/ servir de ponte no envio de registros p/ a lista 74 | Cliente c = new Cliente(); 75 | 76 | // "c" -> Cliente novo - .setNome recebe o campo do banco de String "nome" 77 | c.setId(Integer.valueOf(rs.getString("id_cliente"))); 78 | c.setNome(rs.getString("nome")); 79 | c.setDataNasc(rs.getString("data_nasc")); 80 | c.setSexo(rs.getString("sexo")); 81 | c.setCpf(rs.getString("cpf")); 82 | c.setEndereco(rs.getString("endereco")); 83 | c.setFone(rs.getString("fone")); 84 | 85 | // Adiciona o registro na lista 86 | lista.add(c); 87 | } 88 | 89 | 90 | 91 | // Fecha a conexão com o BD 92 | rs.close(); 93 | stmt.close(); 94 | 95 | // Retorna a lista de registros, gerados pela consulta 96 | return lista; 97 | } 98 | 99 | // UPDATE - Atualiza registros 100 | public void altera(Cliente c) throws SQLException { 101 | // Prepara conexão p/ receber o comando SQL 102 | String sql = "UPDATE cliente set nome=?, data_nasc=?, sexo=?, cpf=?, endereco=?, fone=?" 103 | + "WHERE id_cliente=?"; 104 | // stmt recebe o comando SQL 105 | PreparedStatement stmt = this.conexao.prepareStatement(sql); 106 | 107 | // Seta os valores p/ o stmt, substituindo os "?" 108 | stmt.setInt(7, c.getId()); 109 | stmt.setString(1, c.getNome()); 110 | stmt.setString(2, c.getDataNasc()); 111 | stmt.setString(3, c.getSexo()); 112 | stmt.setString(4, c.getCpf()); 113 | stmt.setString(5, c.getEndereco()); 114 | stmt.setString(6, c.getFone()); 115 | 116 | // O stmt executa o comando SQL no BD, e fecha a conexão 117 | stmt.execute(); 118 | stmt.close(); 119 | } 120 | 121 | // DELETE - Apaga registros 122 | public void remove(int id) throws SQLException { 123 | // Prepara conexão p/ receber o comando SQL 124 | String sql = "DELETE FROM cliente WHERE id_cliente=?"; 125 | // stmt recebe o comando SQL 126 | PreparedStatement stmt = this.conexao.prepareStatement(sql); 127 | 128 | // Seta o valor do ID p/ a condição de verificação SQL, dentro do stmt 129 | stmt.setInt(1, id); 130 | 131 | // Executa o codigo SQL, e fecha 132 | stmt.execute(); 133 | stmt.close(); 134 | 135 | } 136 | /* <-CLIENTE---- */ 137 | } 138 | -------------------------------------------------------------------------------- /src/utils/BdLivro.java: -------------------------------------------------------------------------------- 1 | /* 2 | * To change this license header, choose License Headers in Project Properties. 3 | * To change this template file, choose Tools | Templates 4 | * and open the template in the editor. 5 | */ 6 | package utils; 7 | 8 | import java.sql.Connection; 9 | import java.sql.PreparedStatement; 10 | import java.sql.ResultSet; 11 | import java.sql.SQLException; 12 | import java.util.ArrayList; 13 | import java.util.List; 14 | import model.Livro; 15 | 16 | /** 17 | * 18 | * @author paulojp 19 | */ 20 | public class BdLivro { 21 | 22 | /* ----CONEXÃO COM O BD-> */ 23 | private Connection conexao; 24 | 25 | // Estabelece uma conexão 26 | public BdLivro() throws SQLException { 27 | this.conexao = CriaConexao.getConexao(); 28 | } 29 | /* <-CONEXÃO COM O BD---- */ 30 | 31 | 32 | 33 | 34 | /* ----LIVRO-> */ 35 | 36 | // CREATE - Adiciona um registro 37 | public void adicionaLivro(Livro l) throws SQLException { 38 | // Prepara conexão p/ receber o comando SQL 39 | String sql = "INSERT INTO livro(exemplar, autor, edicao, ano, disponibilidade)" 40 | + "VALUES(?, ?, ?, ?, ?)"; 41 | PreparedStatement stmt; 42 | // stmt recebe o comando SQL 43 | stmt = this.conexao.prepareStatement(sql); 44 | 45 | // Seta os valores p/ o stmt, substituindo os "?" 46 | stmt.setString(1, l.getExemplar()); 47 | stmt.setString(2, l.getAutor()); 48 | stmt.setString(3, String.valueOf(l.getEdicao())); 49 | stmt.setString(4, String.valueOf(l.getAno())); 50 | stmt.setString(5, l.getDisponibilidade()); 51 | 52 | // O stmt executa o comando SQL no BD, e fecha a conexão 53 | stmt.execute(); 54 | stmt.close(); 55 | 56 | } 57 | 58 | // SELECT - Retorna uma lista com o resultado da consulta 59 | public List getLista(String exemplar) throws SQLException{ 60 | // Prepara conexão p/ receber o comando SQL 61 | String sql = "SELECT * FROM livro WHERE exemplar like ?"; 62 | PreparedStatement stmt = this.conexao.prepareStatement(sql); 63 | stmt.setString(1, exemplar); 64 | 65 | // Recebe o resultado da consulta SQL 66 | ResultSet rs = stmt.executeQuery(); 67 | 68 | List lista = new ArrayList<>(); 69 | 70 | // Enquanto existir registros, pega os valores do ReultSet e vai adicionando na lista 71 | while(rs.next()) { 72 | // A cada loop, é instanciado um novo objeto, p/ servir de ponte no envio de registros p/ a lista 73 | Livro l = new Livro(); 74 | 75 | // "c" -> Registro novo - .setNome recebe o campo do banco de String "nome" 76 | l.setId(Integer.valueOf(rs.getString("id_livro"))); 77 | l.setExemplar(rs.getString("exemplar")); 78 | l.setAutor(rs.getString("autor")); 79 | l.setEdicao(Byte.valueOf(rs.getString("edicao"))); 80 | l.setAno(Short.valueOf(rs.getString("ano"))); 81 | l.setDisponibilidade(rs.getString("disponibilidade")); 82 | 83 | // Adiciona o registro na lista 84 | lista.add(l); 85 | } 86 | 87 | // Fecha a conexão com o BD 88 | rs.close(); 89 | stmt.close(); 90 | 91 | // Retorna a lista de registros, gerados pela consulta 92 | return lista; 93 | } 94 | 95 | // UPDATE - Atualiza registros 96 | public void altera(Livro l) throws SQLException { 97 | // Prepara conexão p/ receber o comando SQL 98 | String sql = "UPDATE livro set exemplar=?, autor=?, edicao=?, ano=?, disponibilidade=?" 99 | + "WHERE id_livro=?"; 100 | // stmt recebe o comando SQL 101 | PreparedStatement stmt = this.conexao.prepareStatement(sql); 102 | 103 | // Seta os valores p/ o stmt, substituindo os "?" 104 | stmt.setString(1, l.getExemplar()); 105 | stmt.setString(2, l.getAutor()); 106 | stmt.setString(3, String.valueOf(l.getEdicao())); 107 | stmt.setString(4, String.valueOf(l.getAno())); 108 | stmt.setString(5, l.getDisponibilidade()); 109 | // Usa o ID como parâmetro de comparação no SQL 110 | stmt.setInt(6, l.getId()); 111 | 112 | // O stmt executa o comando SQL no BD, e fecha a conexão 113 | stmt.execute(); 114 | stmt.close(); 115 | } 116 | 117 | // UPDATE - Altera a disponibilidade do livro 118 | public void alteraDisponibilidadeLivro(Livro l) throws SQLException { 119 | // Prepara conexão p/ receber o comando SQL 120 | String sql = "UPDATE livro set disponibilidade=?" 121 | + "WHERE id_livro=?"; 122 | // stmt recebe o comando SQL 123 | PreparedStatement stmt = this.conexao.prepareStatement(sql); 124 | 125 | // Seta os valores p/ o stmt, substituindo os "?" 126 | stmt.setString(1, l.getDisponibilidade()); 127 | // Usa o ID como parâmetro de comparação no SQL 128 | stmt.setInt(2, l.getId()); 129 | 130 | // O stmt executa o comando SQL no BD, e fecha a conexão 131 | stmt.execute(); 132 | stmt.close(); 133 | } 134 | 135 | // DELETE - Apaga registros 136 | public void remove(int id) throws SQLException { 137 | // Prepara conexão p/ receber o comando SQL 138 | String sql = "DELETE FROM livro WHERE id_livro=?"; 139 | // stmt recebe o comando SQL 140 | PreparedStatement stmt = this.conexao.prepareStatement(sql); 141 | 142 | // Seta o valor do ID p/ a condição de verificação SQL, dentro do stmt 143 | stmt.setInt(1, id); 144 | 145 | // Executa o codigo SQL, e fecha 146 | stmt.execute(); 147 | stmt.close(); 148 | 149 | } 150 | /* <-LIVRO---- */ 151 | } 152 | -------------------------------------------------------------------------------- /src/view/JFPrincipal.form: -------------------------------------------------------------------------------- 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 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 |
130 | -------------------------------------------------------------------------------- /src/utils/BdEmprestimo.java: -------------------------------------------------------------------------------- 1 | /* 2 | * To change this license header, choose License Headers in Project Properties. 3 | * To change this template file, choose Tools | Templates 4 | * and open the template in the editor. 5 | */ 6 | package utils; 7 | 8 | import java.sql.Connection; 9 | import java.sql.PreparedStatement; 10 | import java.sql.ResultSet; 11 | import java.sql.SQLException; 12 | import java.util.ArrayList; 13 | import java.util.List; 14 | import model.Emprestimo; 15 | 16 | /** 17 | * 18 | * @author paulojp 19 | */ 20 | public class BdEmprestimo { 21 | 22 | /* ----CONEXÃO COM O BD-> */ 23 | private Connection conexao; 24 | 25 | // Estabelece uma conexão 26 | public BdEmprestimo() throws SQLException { 27 | this.conexao = CriaConexao.getConexao(); 28 | } 29 | /* <-CONEXÃO COM O BD---- */ 30 | 31 | 32 | 33 | 34 | /* ----EMPRESTIMO-> */ 35 | 36 | // CREATE - Adiciona um registro 37 | public void adicionaEmprestimo(Emprestimo e) throws SQLException { 38 | // Prepara conexão p/ receber o comando SQL 39 | String sql = "INSERT INTO emprestimo(id_cliente, id_livro, data_emprestimo, data_devolucao) VALUES(?, ?, ?, ?)"; 40 | PreparedStatement stmt; 41 | // stmt recebe o comando SQL 42 | stmt = this.conexao.prepareStatement(sql); 43 | 44 | // Seta os valores p/ o stmt, substituindo os "?" 45 | stmt.setString(1, String.valueOf(e.getId_cliente())); 46 | stmt.setString(2, String.valueOf(e.getId_livro())); 47 | stmt.setString(3, e.getData_emprestimo()); 48 | stmt.setString(4, e.getData_devolucao()); 49 | 50 | // O stmt executa o comando SQL no BD, e fecha a conexão 51 | stmt.execute(); 52 | stmt.close(); 53 | 54 | } 55 | 56 | // SELECT - Retorna uma lista com o resultado da consulta 57 | public List getLista(String id) throws SQLException{ 58 | // Prepara conexão p/ receber o comando SQL 59 | String sql = "SELECT * FROM emprestimo WHERE id_emprestimo like ?"; 60 | PreparedStatement stmt = this.conexao.prepareStatement(sql); 61 | stmt.setString(1, id); 62 | 63 | // Recebe o resultado da consulta SQL 64 | ResultSet rs = stmt.executeQuery(); 65 | 66 | List lista = new ArrayList<>(); 67 | 68 | // Enquanto existir registros, pega os valores do ReultSet e vai adicionando na lista 69 | while(rs.next()) { 70 | // A cada loop, é instanciado um novo objeto, p/ servir de ponte no envio de registros p/ a lista 71 | Emprestimo e = new Emprestimo(); 72 | 73 | // "c" -> Registro novo - .setNome recebe o campo do banco de String "nome" 74 | e.setId_emprestimo(Integer.valueOf(rs.getString("id_emprestimo"))); 75 | e.setId_cliente(Integer.valueOf(rs.getString("id_cliente"))); 76 | e.setId_livro(Integer.valueOf(rs.getString("id_livro"))); 77 | e.setData_emprestimo(rs.getString("data_emprestimo")); 78 | e.setData_devolucao(rs.getString("data_devolucao")); 79 | 80 | // Adiciona o registro na lista 81 | lista.add(e); 82 | } 83 | 84 | // Fecha a conexão com o BD 85 | rs.close(); 86 | stmt.close(); 87 | 88 | // Retorna a lista de registros, gerados pela consulta 89 | return lista; 90 | } 91 | 92 | // SELECT - Retorna uma lista com as multas de um clientes epecífico 93 | public List getListaPorCliente(String id_cliente) throws SQLException{ 94 | // Prepara conexão p/ receber o comando SQL 95 | String sql = "SELECT emprestimo.id_emprestimo, emprestimo.id_cliente, emprestimo.id_livro, emprestimo.data_emprestimo, emprestimo.data_devolucao" + 96 | " FROM emprestimo" + 97 | " INNER JOIN cliente" + 98 | " ON emprestimo.id_cliente = cliente.id_cliente" + 99 | " WHERE emprestimo.id_cliente = ?;"; 100 | PreparedStatement stmt = this.conexao.prepareStatement(sql); 101 | stmt.setString(1, id_cliente); 102 | 103 | // Recebe o resultado da consulta SQL 104 | ResultSet rs = stmt.executeQuery(); 105 | 106 | List lista = new ArrayList<>(); 107 | 108 | // Enquanto existir registros, pega os valores do ReultSet e vai adicionando na lista 109 | while(rs.next()) { 110 | // A cada loop, é instanciado um novo objeto, p/ servir de ponte no envio de registros p/ a lista 111 | Emprestimo e = new Emprestimo(); 112 | 113 | // "c" -> Registro novo - .setNome recebe o campo do banco de String "nome" 114 | e.setId_emprestimo(Integer.valueOf(rs.getString("emprestimo.id_emprestimo"))); 115 | e.setId_cliente(Integer.valueOf(rs.getString("emprestimo.id_cliente"))); 116 | e.setId_livro(Integer.valueOf(rs.getString("emprestimo.id_livro"))); 117 | e.setData_emprestimo(rs.getString("emprestimo.data_emprestimo")); 118 | e.setData_devolucao(rs.getString("emprestimo.data_devolucao")); 119 | 120 | // Adiciona o registro na lista 121 | lista.add(e); 122 | } 123 | 124 | // Fecha a conexão com o BD 125 | rs.close(); 126 | stmt.close(); 127 | 128 | // Retorna a lista de registros, gerados pela consulta 129 | return lista; 130 | } 131 | 132 | // SELECT - Verifica se o cliente tem alguma multa 133 | public boolean verificaMultaCliente(String id_cliente) throws SQLException{ 134 | 135 | // Prepara conexão p/ receber o comando SQL 136 | String sql = "SELECT COUNT(multa.id_cliente) AS quantMulta" + 137 | " FROM multa" + 138 | " WHERE id_cliente = ?;"; 139 | PreparedStatement stmt = this.conexao.prepareStatement(sql); 140 | stmt.setString(1, id_cliente); 141 | 142 | // Recebe o resultado da consulta SQL 143 | ResultSet rs = stmt.executeQuery(); 144 | 145 | rs.next(); 146 | 147 | int quantMulta = 0; 148 | quantMulta = rs.getInt("quantMulta"); 149 | 150 | // Fecha a conexão com o BD 151 | rs.close(); 152 | stmt.close(); 153 | 154 | if (quantMulta > 0) { 155 | return true; 156 | } 157 | 158 | return false; 159 | } 160 | 161 | // DELETE - Apaga registros 162 | public void remove(int id) throws SQLException { 163 | // Prepara conexão p/ receber o comando SQL 164 | String sql = "DELETE FROM emprestimo WHERE id_emprestimo=?"; 165 | // stmt recebe o comando SQL 166 | PreparedStatement stmt = this.conexao.prepareStatement(sql); 167 | 168 | // Seta o valor do ID p/ a condição de verificação SQL, dentro do stmt 169 | stmt.setInt(1, id); 170 | 171 | // Executa o codigo SQL, e fecha 172 | stmt.execute(); 173 | stmt.close(); 174 | 175 | } 176 | /* <-EMPRESTIMO---- */ 177 | } 178 | -------------------------------------------------------------------------------- /src/utils/BdMulta.java: -------------------------------------------------------------------------------- 1 | /* 2 | * To change this license header, choose License Headers in Project Properties. 3 | * To change this template file, choose Tools | Templates 4 | * and open the template in the editor. 5 | */ 6 | package utils; 7 | 8 | import java.sql.Connection; 9 | import java.sql.PreparedStatement; 10 | import java.sql.ResultSet; 11 | import java.sql.SQLException; 12 | import java.util.ArrayList; 13 | import java.util.List; 14 | import model.Multa; 15 | 16 | /** 17 | * 18 | * @author paulojp 19 | */ 20 | public class BdMulta { 21 | 22 | /* ----CONEXÃO COM O BD-> */ 23 | private Connection conexao; 24 | 25 | // Estabelece uma conexão 26 | public BdMulta() throws SQLException { 27 | this.conexao = CriaConexao.getConexao(); 28 | } 29 | /* <-CONEXÃO COM O BD---- */ 30 | 31 | 32 | 33 | 34 | /* ----MULTA-> */ 35 | 36 | // CREATE - Adiciona um registro 37 | public void adicionaMulta(Multa m) throws SQLException { 38 | // Prepara conexão p/ receber o comando SQL 39 | String sql = "INSERT INTO multa(id_cliente, descricao, valor) VALUES(?, ?, ?)"; 40 | PreparedStatement stmt; 41 | // stmt recebe o comando SQL 42 | stmt = this.conexao.prepareStatement(sql); 43 | 44 | // Seta os valores p/ o stmt, substituindo os "?" 45 | stmt.setString(1, String.valueOf(m.getId_cliente())); 46 | stmt.setString(2, m.getDescricao()); 47 | stmt.setString(3, String.valueOf(m.getValor())); 48 | 49 | // O stmt executa o comando SQL no BD, e fecha a conexão 50 | stmt.execute(); 51 | stmt.close(); 52 | 53 | } 54 | 55 | // SELECT - Retorna uma lista com o resultado da consulta 56 | public List getLista(String id) throws SQLException{ 57 | // Prepara conexão p/ receber o comando SQL 58 | String sql = "SELECT * FROM multa WHERE id_multa like ?"; 59 | PreparedStatement stmt = this.conexao.prepareStatement(sql); 60 | stmt.setString(1, id); 61 | 62 | // Recebe o resultado da consulta SQL 63 | ResultSet rs = stmt.executeQuery(); 64 | 65 | List lista = new ArrayList<>(); 66 | 67 | // Enquanto existir registros, pega os valores do ReultSet e vai adicionando na lista 68 | while(rs.next()) { 69 | // A cada loop, é instanciado um novo objeto, p/ servir de ponte no envio de registros p/ a lista 70 | Multa m = new Multa(); 71 | 72 | // "c" -> Registro novo - .setNome recebe o campo do banco de String "nome" 73 | m.setId_multa(Integer.valueOf(rs.getString("id_multa"))); 74 | m.setId_cliente(Integer.valueOf(rs.getString("id_cliente"))); 75 | m.setDescricao(rs.getString("descricao")); 76 | m.setValor(Float.valueOf(rs.getString("valor"))); 77 | 78 | // Adiciona o registro na lista 79 | lista.add(m); 80 | } 81 | 82 | // Fecha a conexão com o BD 83 | rs.close(); 84 | stmt.close(); 85 | 86 | // Retorna a lista de registros, gerados pela consulta 87 | return lista; 88 | } 89 | 90 | // SELECT - Retorna uma lista com as multas de um determinado cliente 91 | public List getListaMultaPorCliente(String id_cliente) throws SQLException{ 92 | // Prepara conexão p/ receber o comando SQL 93 | String sql = "SELECT multa.id_multa, multa.id_cliente, multa.descricao, multa.valor " + 94 | "FROM multa " + 95 | "INNER JOIN cliente " + 96 | "ON multa.id_cliente = cliente.id_cliente " + 97 | "WHERE multa.id_cliente = ?;"; 98 | PreparedStatement stmt = this.conexao.prepareStatement(sql); 99 | stmt.setString(1, id_cliente); 100 | 101 | // Recebe o resultado da consulta SQL 102 | ResultSet rs = stmt.executeQuery(); 103 | 104 | List lista = new ArrayList<>(); 105 | 106 | // Enquanto existir registros, pega os valores do ReultSet e vai adicionando na lista 107 | while(rs.next()) { 108 | // A cada loop, é instanciado um novo objeto, p/ servir de ponte no envio de registros p/ a lista 109 | Multa m = new Multa(); 110 | 111 | // "c" -> Registro novo - .setNome recebe o campo do banco de String "nome" 112 | m.setId_multa(Integer.valueOf(rs.getString("multa.id_multa"))); 113 | m.setId_cliente(Integer.valueOf(rs.getString("multa.id_cliente"))); 114 | m.setDescricao(rs.getString("multa.descricao")); 115 | m.setValor(Float.valueOf(rs.getString("multa.valor"))); 116 | 117 | // Adiciona o registro na lista 118 | lista.add(m); 119 | } 120 | 121 | // Fecha a conexão com o BD 122 | rs.close(); 123 | stmt.close(); 124 | 125 | // Retorna a lista de registros, gerados pela consulta 126 | return lista; 127 | } 128 | 129 | // SELECT - Retorna o valor total das multas de um cliente 130 | public String totalMultaCliente(String id_cliente) throws SQLException { 131 | System.out.println("asdj89asduasd8asd8"); 132 | // Prepara conexão p/ receber o comando SQL 133 | String sql = "SELECT SUM(multa.valor) AS totalMulta FROM multa " 134 | + "INNER JOIN cliente ON multa.id_cliente = cliente.id_cliente " 135 | + "WHERE cliente.id_cliente = ? " 136 | + "GROUP BY cliente.id_cliente;"; 137 | PreparedStatement stmt = this.conexao.prepareStatement(sql); 138 | stmt.setString(1, id_cliente); 139 | 140 | // Recebe o resultado da consulta SQL 141 | ResultSet rs = stmt.executeQuery(); 142 | 143 | rs.next(); 144 | String totalMulta = String.valueOf(rs.getFloat("totalMulta")); 145 | 146 | System.out.println(totalMulta); 147 | 148 | // Fecha a conexão com o BD 149 | rs.close(); 150 | stmt.close(); 151 | 152 | // Retorna a lista de registros, gerados pela consulta 153 | System.out.println("asdj89asduasd8asd8"); 154 | return totalMulta; 155 | 156 | } 157 | 158 | // DELETE - Apaga registros 159 | public void remove(int id) throws SQLException { 160 | // Prepara conexão p/ receber o comando SQL 161 | String sql = "DELETE FROM multa WHERE id_multa=?"; 162 | // stmt recebe o comando SQL 163 | PreparedStatement stmt = this.conexao.prepareStatement(sql); 164 | 165 | // Seta o valor do ID p/ a condição de verificação SQL, dentro do stmt 166 | stmt.setInt(1, id); 167 | 168 | // Executa o codigo SQL, e fecha 169 | stmt.execute(); 170 | stmt.close(); 171 | } 172 | 173 | // DELETE - Apaga todas as multas 174 | public void removeMultas(String id) throws SQLException { 175 | // Prepara conexão p/ receber o comando SQL 176 | String sql = "DELETE FROM multa WHERE id_cliente=?"; 177 | // stmt recebe o comando SQL 178 | PreparedStatement stmt = this.conexao.prepareStatement(sql); 179 | 180 | // Seta o valor do ID p/ a condição de verificação SQL, dentro do stmt 181 | stmt.setString(1, id); 182 | 183 | // Executa o codigo SQL, e fecha 184 | stmt.execute(); 185 | stmt.close(); 186 | } 187 | 188 | /* <-MULTA---- */ 189 | } 190 | -------------------------------------------------------------------------------- /src/view/JFPrincipal.java: -------------------------------------------------------------------------------- 1 | /* 2 | * To change this license header, choose License Headers in Project Properties. 3 | * To change this template file, choose Tools | Templates 4 | * and open the template in the editor. 5 | */ 6 | package view; 7 | 8 | /** 9 | * 10 | * @author paulojp 11 | */ 12 | public class JFPrincipal extends javax.swing.JFrame { 13 | 14 | /** 15 | * Creates new form Principal 16 | */ 17 | public JFPrincipal() { 18 | initComponents(); 19 | } 20 | 21 | /** 22 | * This method is called from within the constructor to initialize the form. 23 | * WARNING: Do NOT modify this code. The content of this method is always 24 | * regenerated by the Form Editor. 25 | */ 26 | @SuppressWarnings("unchecked") 27 | // //GEN-BEGIN:initComponents 28 | private void initComponents() { 29 | 30 | jLabel2 = new javax.swing.JLabel(); 31 | jMenuBar1 = new javax.swing.JMenuBar(); 32 | jMenu2 = new javax.swing.JMenu(); 33 | jMCliente = new javax.swing.JMenuItem(); 34 | jMenu3 = new javax.swing.JMenu(); 35 | jMLivro = new javax.swing.JMenuItem(); 36 | jMenu6 = new javax.swing.JMenu(); 37 | jMEmprestimo = new javax.swing.JMenuItem(); 38 | jMenu7 = new javax.swing.JMenu(); 39 | jMMulta = new javax.swing.JMenuItem(); 40 | jMenu4 = new javax.swing.JMenu(); 41 | 42 | setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); 43 | setTitle("Biblioteca"); 44 | 45 | jLabel2.setIcon(new javax.swing.ImageIcon(getClass().getResource("/utils/imagens/antique-library-302930.jpg"))); // NOI18N 46 | 47 | jMenu2.setText("Cliente"); 48 | 49 | jMCliente.setText("Editar Clientes"); 50 | jMCliente.addActionListener(new java.awt.event.ActionListener() { 51 | public void actionPerformed(java.awt.event.ActionEvent evt) { 52 | jMClienteActionPerformed(evt); 53 | } 54 | }); 55 | jMenu2.add(jMCliente); 56 | 57 | jMenuBar1.add(jMenu2); 58 | 59 | jMenu3.setText("Livro"); 60 | 61 | jMLivro.setText("Editar Livros"); 62 | jMLivro.addActionListener(new java.awt.event.ActionListener() { 63 | public void actionPerformed(java.awt.event.ActionEvent evt) { 64 | jMLivroActionPerformed(evt); 65 | } 66 | }); 67 | jMenu3.add(jMLivro); 68 | 69 | jMenuBar1.add(jMenu3); 70 | 71 | jMenu6.setText("Empréstimo"); 72 | 73 | jMEmprestimo.setText("Editar Emprestimos"); 74 | jMEmprestimo.addActionListener(new java.awt.event.ActionListener() { 75 | public void actionPerformed(java.awt.event.ActionEvent evt) { 76 | jMEmprestimoActionPerformed(evt); 77 | } 78 | }); 79 | jMenu6.add(jMEmprestimo); 80 | 81 | jMenuBar1.add(jMenu6); 82 | 83 | jMenu7.setText("Multa"); 84 | 85 | jMMulta.setText("Editar Multas"); 86 | jMMulta.addActionListener(new java.awt.event.ActionListener() { 87 | public void actionPerformed(java.awt.event.ActionEvent evt) { 88 | jMMultaActionPerformed(evt); 89 | } 90 | }); 91 | jMenu7.add(jMMulta); 92 | 93 | jMenuBar1.add(jMenu7); 94 | 95 | jMenu4.setText("Sair"); 96 | jMenu4.addMouseListener(new java.awt.event.MouseAdapter() { 97 | public void mouseClicked(java.awt.event.MouseEvent evt) { 98 | jMenu4MouseClicked(evt); 99 | } 100 | }); 101 | jMenu4.addActionListener(new java.awt.event.ActionListener() { 102 | public void actionPerformed(java.awt.event.ActionEvent evt) { 103 | jMenu4ActionPerformed(evt); 104 | } 105 | }); 106 | jMenuBar1.add(jMenu4); 107 | 108 | setJMenuBar(jMenuBar1); 109 | 110 | javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); 111 | getContentPane().setLayout(layout); 112 | layout.setHorizontalGroup( 113 | layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) 114 | .addGroup(layout.createSequentialGroup() 115 | .addContainerGap() 116 | .addComponent(jLabel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) 117 | .addContainerGap()) 118 | ); 119 | layout.setVerticalGroup( 120 | layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) 121 | .addGroup(layout.createSequentialGroup() 122 | .addContainerGap() 123 | .addComponent(jLabel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) 124 | .addContainerGap()) 125 | ); 126 | 127 | pack(); 128 | setLocationRelativeTo(null); 129 | }// //GEN-END:initComponents 130 | 131 | private void jMLivroActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMLivroActionPerformed 132 | 133 | // Abre a janela 134 | new JFLivro(this).setVisible(true); 135 | 136 | this.setEnabled(false); 137 | 138 | }//GEN-LAST:event_jMLivroActionPerformed 139 | 140 | private void jMenu4MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jMenu4MouseClicked 141 | System.exit(0); 142 | }//GEN-LAST:event_jMenu4MouseClicked 143 | 144 | private void jMClienteActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMClienteActionPerformed 145 | 146 | // Abre a janela 147 | // this(Esta janela) - Passa a instancia da tela atual como parâmetro p/ o contrutor 148 | new JFCliente(this).setVisible(true); 149 | 150 | // Desativa funcionalidades da tabela principal 151 | this.setEnabled(false); 152 | 153 | }//GEN-LAST:event_jMClienteActionPerformed 154 | 155 | private void jMenu4ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenu4ActionPerformed 156 | System.exit(0); 157 | }//GEN-LAST:event_jMenu4ActionPerformed 158 | 159 | private void jMEmprestimoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMEmprestimoActionPerformed 160 | 161 | // Abre a janela 162 | new JFEmprestimo(this).setVisible(true); 163 | 164 | this.setEnabled(false); 165 | 166 | }//GEN-LAST:event_jMEmprestimoActionPerformed 167 | 168 | private void jMMultaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMMultaActionPerformed 169 | 170 | new JFMulta().setVisible(true); 171 | 172 | }//GEN-LAST:event_jMMultaActionPerformed 173 | 174 | /** 175 | * @param args the command line arguments 176 | */ 177 | public static void main(String args[]) { 178 | /* Set the Nimbus look and feel */ 179 | // 180 | /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel. 181 | * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html 182 | */ 183 | try { 184 | for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) { 185 | if ("Nimbus".equals(info.getName())) { 186 | javax.swing.UIManager.setLookAndFeel(info.getClassName()); 187 | break; 188 | } 189 | } 190 | } catch (ClassNotFoundException ex) { 191 | java.util.logging.Logger.getLogger(JFPrincipal.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); 192 | } catch (InstantiationException ex) { 193 | java.util.logging.Logger.getLogger(JFPrincipal.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); 194 | } catch (IllegalAccessException ex) { 195 | java.util.logging.Logger.getLogger(JFPrincipal.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); 196 | } catch (javax.swing.UnsupportedLookAndFeelException ex) { 197 | java.util.logging.Logger.getLogger(JFPrincipal.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); 198 | } 199 | // 200 | // 201 | 202 | /* Create and display the form */ 203 | java.awt.EventQueue.invokeLater(new Runnable() { 204 | public void run() { 205 | new JFPrincipal().setVisible(true); 206 | } 207 | }); 208 | } 209 | 210 | // Variables declaration - do not modify//GEN-BEGIN:variables 211 | private javax.swing.JLabel jLabel2; 212 | private javax.swing.JMenuItem jMCliente; 213 | private javax.swing.JMenuItem jMEmprestimo; 214 | private javax.swing.JMenuItem jMLivro; 215 | private javax.swing.JMenuItem jMMulta; 216 | private javax.swing.JMenu jMenu2; 217 | private javax.swing.JMenu jMenu3; 218 | private javax.swing.JMenu jMenu4; 219 | private javax.swing.JMenu jMenu6; 220 | private javax.swing.JMenu jMenu7; 221 | private javax.swing.JMenuBar jMenuBar1; 222 | // End of variables declaration//GEN-END:variables 223 | } 224 | -------------------------------------------------------------------------------- /src/view/JFLivro.form: -------------------------------------------------------------------------------- 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 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | 191 | 192 | 193 | 194 | 195 | 196 | 197 | 198 | 199 | 200 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 209 | 210 | 211 | 212 | 213 | 214 | 215 | 216 | 217 | 218 | 219 | 220 | 221 | 222 | 223 | 224 | 225 | 226 | 227 | 228 | 229 | 230 | 231 | 232 | 233 | 234 | 235 | 236 | 237 | 238 | 239 | 240 | 241 | 242 | 243 | 244 | 245 | 246 | 247 | 248 | 249 | 250 | 251 | 252 | 253 | 254 | 255 | 256 | 257 | 258 | 259 | 260 | 261 | 262 | 263 | 264 | 265 | 266 | 267 | 268 | 269 | 270 | 271 | 272 | 273 | 274 | 275 | 276 | 277 | 278 | 279 | 280 | 281 | 282 | 283 | 284 | 285 | 286 | 287 | 288 | 289 | 290 | 291 | 292 | 293 | 294 | 295 | 296 | 297 | 298 | 299 | 300 | 301 | 302 | 303 | 304 | 305 | 306 | 307 | 308 | 309 | 310 | 311 | 312 | 313 | 314 | 315 | 316 | 317 | 318 | 319 | 320 | 321 | 322 | 323 | 324 | 325 | 326 | 327 | 328 | 329 | 330 | 331 | 332 | 333 | 334 | 335 | 336 | 337 | 338 | 339 | 340 | 341 | 342 | 343 | 344 | 345 | 346 | 347 | 348 | 349 | 350 | 351 | 352 | 353 | 354 | 355 | 356 | 357 | 358 | 359 | 360 |
361 | -------------------------------------------------------------------------------- /src/view/JFCliente.form: -------------------------------------------------------------------------------- 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 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | 191 | 192 | 193 | 194 | 195 | 196 | 197 | 198 | 199 | 200 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 209 | 210 | 211 | 212 | 213 | 214 | 215 | 216 | 217 | 218 | 219 | 220 | 221 | 222 | 223 | 224 | 225 | 226 | 227 | 228 | 229 | 230 | 231 | 232 | 233 | 234 | 235 | 236 | 237 | 238 | 239 | 240 | 241 | 242 | 243 | 244 | 245 | 246 | 247 | 248 | 249 | 250 | 251 | 252 | 253 | 254 | 255 | 256 | 257 | 258 | 259 | 260 | 261 | 262 | 263 | 264 | 265 | 266 | 267 | 268 | 269 | 270 | 271 | 272 | 273 | 274 | 275 | 276 | 277 | 278 | 279 | 280 | 281 | 282 | 283 | 284 | 285 | 286 | 287 | 288 | 289 | 290 | 291 | 292 | 293 | 294 | 295 | 296 | 297 | 298 | 299 | 300 | 301 | 302 | 303 | 304 | 305 | 306 | 307 | 308 | 309 | 310 | 311 | 312 | 313 | 314 | 315 | 316 | 317 | 318 | 319 | 320 | 321 | 322 | 323 | 324 | 325 | 326 | 327 | 328 | 329 | 330 | 331 | 332 | 333 | 334 | 335 | 336 | 337 | 338 | 339 | 340 | 341 | 342 | 343 | 344 | 345 | 346 | 347 | 348 | 349 | 350 | 351 | 352 | 353 | 354 | 355 | 356 | 357 | 358 | 359 | 360 | 361 | 362 | 363 | 364 | 365 | 366 | 367 | 368 | 369 | 370 | 371 | 372 | 373 | 374 | 375 | 376 | 377 | 378 | 379 | 380 | 381 | 382 | 383 | 384 | 385 | 386 | 387 | 388 | 389 | 390 | 391 | 392 | 393 | 394 | 395 | 396 | 397 | 398 | 399 | 400 | 401 | 402 | 403 | 404 | 405 | 406 |
407 | -------------------------------------------------------------------------------- /src/view/JFMulta.form: -------------------------------------------------------------------------------- 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 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | 191 | 192 | 193 | 194 | 195 | 196 | 197 | 198 | 199 | 200 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 209 | 210 | 211 | 212 | 213 | 214 | 215 | 216 | 217 | 218 | 219 | 220 | 221 | 222 | 223 | 224 | 225 | 226 | 227 | 228 | 229 | 230 | 231 | 232 | 233 | 234 | 235 | 236 | 237 | 238 | 239 | 240 | 241 | 242 | 243 | 244 | 245 | 246 | 247 | 248 | 249 | 250 | 251 | 252 | 253 | 254 | 255 | 256 | 257 | 258 | 259 | 260 | 261 | 262 | 263 | 264 | 265 | 266 | 267 | 268 | 269 | 270 | 271 | 272 | 273 | 274 | 275 | 276 | 277 | 278 | 279 | 280 | 281 | 282 | 283 | 284 | 285 | 286 | 287 | 288 | 289 | 290 | 291 | 292 | 293 | 294 | 295 | 296 | 297 | 298 | 299 | 300 | 301 | 302 | 303 | 304 | 305 | 306 | 307 | 308 | 309 | 310 | 311 | 312 | 313 | 314 | 315 | 316 | 317 | 318 | 319 | 320 | 321 | 322 | 323 | 324 | 325 | 326 | 327 | 328 | 329 | 330 | 331 | 332 | 333 | 334 | 335 | 336 | 337 | 338 | 339 | 340 | 341 | 342 | 343 | 344 | 345 | 346 | 347 | 348 | 349 | 350 | 351 | 352 | 353 | 354 | 355 | 356 | 357 | 358 | 359 | 360 | 361 | 362 | 363 | 364 | 365 | 366 | 367 | 368 | 369 | 370 | 371 | 372 | 373 | 374 | 375 | 376 | 377 | 378 | 379 | 380 | 381 | 382 | 383 | 384 | 385 | 386 | 387 | 388 | 389 | 390 | 391 | 392 | 393 | 394 | 395 | 396 | 397 | 398 | 399 | 400 | 401 | 402 | 403 | 404 | 405 | 406 | 407 | 408 | 409 | 410 | 411 | 412 | 413 | 414 | 415 | 416 | 417 | 418 | 419 | 420 | 421 | 422 | 423 | 424 | 425 | 426 | 427 | 428 | 429 | 430 | 431 | 432 | 433 | 434 | 435 | 436 | 437 | 438 | 439 | 440 | 441 | 442 | 443 | 444 | 445 | 446 | 447 | 448 | 449 | 450 | 451 | 452 | 453 | 454 | 455 | 456 |
457 | -------------------------------------------------------------------------------- /src/view/JFEmprestimo.form: -------------------------------------------------------------------------------- 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 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | 191 | 192 | 193 | 194 | 195 | 196 | 197 | 198 | 199 | 200 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 209 | 210 | 211 | 212 | 213 | 214 | 215 | 216 | 217 | 218 | 219 | 220 | 221 | 222 | 223 | 224 | 225 | 226 | 227 | 228 | 229 | 230 | 231 | 232 | 233 | 234 | 235 | 236 | 237 | 238 | 239 | 240 | 241 | 242 | 243 | 244 | 245 | 246 | 247 | 248 | 249 | 250 | 251 | 252 | 253 | 254 | 255 | 256 | 257 | 258 | 259 | 260 | 261 | 262 | 263 | 264 | 265 | 266 | 267 | 268 | 269 | 270 | 271 | 272 | 273 | 274 | 275 | 276 | 277 | 278 | 279 | 280 | 281 | 282 | 283 | 284 | 285 | 286 | 287 | 288 | 289 | 290 | 291 | 292 | 293 | 294 | 295 | 296 | 297 | 298 | 299 | 300 | 301 | 302 | 303 | 304 | 305 | 306 | 307 | 308 | 309 | 310 | 311 | 312 | 313 | 314 | 315 | 316 | 317 | 318 | 319 | 320 | 321 | 322 | 323 | 324 | 325 | 326 | 327 | 328 | 329 | 330 | 331 | 332 | 333 | 334 | 335 | 336 | 337 | 338 | 339 | 340 | 341 | 342 | 343 | 344 | 345 | 346 | 347 | 348 | 349 | 350 | 351 | 352 | 353 | 354 | 355 | 356 | 357 | 358 | 359 | 360 | 361 | 362 | 363 | 364 | 365 | 366 | 367 | 368 | 369 | 370 | 371 | 372 | 373 | 374 | 375 | 376 | 377 | 378 | 379 | 380 | 381 | 382 | 383 | 384 | 385 | 386 | 387 | 388 | 389 | 390 | 391 | 392 | 393 | 394 | 395 | 396 | 397 | 398 | 399 | 400 | 401 | 402 | 403 | 404 | 405 | 406 | 407 | 408 | 409 | 410 | 411 | 412 | 413 | 414 | 415 | 416 | 417 | 418 | 419 | 420 | 421 | 422 | 423 | 424 | 425 | 426 | 427 | 428 | 429 | 430 | 431 | 432 | 433 | 434 | 435 | 436 | 437 | 438 | 439 | 440 | 441 | 442 | 443 | 444 | 445 | 446 | 447 | 448 | 449 | 450 | 451 | 452 | 453 | 454 | 455 | 456 | 457 | 458 | 459 | 460 | 461 | 462 | 463 | 464 | 465 | 466 | 467 | 468 | 469 | 470 | 471 | 472 | 473 | 474 | 475 | 476 | 477 | 478 | 479 | 480 | 481 | 482 | 483 | 484 | 485 | 486 | 487 | 488 | 489 | 490 | 491 | 492 | 493 | 494 | 495 | 496 | 497 | 498 | 499 | 500 | 501 | 502 | 503 | 504 | 505 | 506 | 507 | 508 | 509 | 510 | 511 | 512 | 513 | 514 | 515 | 516 | 517 | 518 | 519 | 520 | 521 | 522 | 523 | 524 | 525 | 526 | 527 | 528 |
529 | -------------------------------------------------------------------------------- /src/view/JFLivro.java: -------------------------------------------------------------------------------- 1 | /* 2 | * To change this license header, choose License Headers in Project Properties. 3 | * To change this template file, choose Tools | Templates 4 | * and open the template in the editor. 5 | */ 6 | package view; 7 | 8 | import java.sql.SQLException; 9 | import java.util.List; 10 | import javax.swing.JOptionPane; 11 | import javax.swing.table.DefaultTableModel; 12 | import model.Livro; 13 | import utils.BdLivro; 14 | 15 | 16 | /** 17 | * 18 | * @author paulojp 19 | */ 20 | public class JFLivro extends javax.swing.JFrame { 21 | 22 | private JFPrincipal telaPrincipal; 23 | 24 | /** 25 | * Creates new form Cliente 26 | */ 27 | public JFLivro() { 28 | initComponents(); 29 | 30 | // Desabilita os campos ao iniciar a janela 31 | desabilitaCampos(); 32 | } 33 | 34 | JFLivro(JFPrincipal telaPrincipal) { 35 | 36 | this(); 37 | this.telaPrincipal = telaPrincipal; 38 | 39 | } 40 | 41 | /** 42 | * This method is called from within the constructor to initialize the form. 43 | * WARNING: Do NOT modify this code. The content of this method is always 44 | * regenerated by the Form Editor. 45 | */ 46 | @SuppressWarnings("unchecked") 47 | // //GEN-BEGIN:initComponents 48 | private void initComponents() { 49 | 50 | jPanel1 = new javax.swing.JPanel(); 51 | jLabel1 = new javax.swing.JLabel(); 52 | jLabel2 = new javax.swing.JLabel(); 53 | jLabel3 = new javax.swing.JLabel(); 54 | jLabel4 = new javax.swing.JLabel(); 55 | jLabel5 = new javax.swing.JLabel(); 56 | jLabel7 = new javax.swing.JLabel(); 57 | jT1Exemplar = new javax.swing.JTextField(); 58 | jT2Autor = new javax.swing.JTextField(); 59 | jT3Edicao = new javax.swing.JTextField(); 60 | jT4Ano = new javax.swing.JTextField(); 61 | jT5Status = new javax.swing.JTextField(); 62 | jT0Id = new javax.swing.JTextField(); 63 | jPanel2 = new javax.swing.JPanel(); 64 | jTPesquisar = new javax.swing.JTextField(); 65 | jBPesquisar = new javax.swing.JButton(); 66 | jScrollPane1 = new javax.swing.JScrollPane(); 67 | jTablePesquisa = new javax.swing.JTable(); 68 | jLabel8 = new javax.swing.JLabel(); 69 | jPanel3 = new javax.swing.JPanel(); 70 | jBExcluir = new javax.swing.JButton(); 71 | jBAlterar = new javax.swing.JButton(); 72 | jBNovo = new javax.swing.JButton(); 73 | jBCadastrar = new javax.swing.JButton(); 74 | jBSair = new javax.swing.JButton(); 75 | 76 | setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE); 77 | setTitle("Livros"); 78 | addWindowListener(new java.awt.event.WindowAdapter() { 79 | public void windowClosed(java.awt.event.WindowEvent evt) { 80 | formWindowClosed(evt); 81 | } 82 | }); 83 | 84 | jPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder("Dados Livros")); 85 | 86 | jLabel1.setText("Exemplar: "); 87 | 88 | jLabel2.setText("Autor: "); 89 | 90 | jLabel3.setText("Edição: "); 91 | 92 | jLabel4.setText("Ano: "); 93 | 94 | jLabel5.setText("Disponibilidade: "); 95 | 96 | jLabel7.setText("ID: "); 97 | 98 | javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1); 99 | jPanel1.setLayout(jPanel1Layout); 100 | jPanel1Layout.setHorizontalGroup( 101 | jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) 102 | .addGroup(jPanel1Layout.createSequentialGroup() 103 | .addContainerGap() 104 | .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) 105 | .addGroup(jPanel1Layout.createSequentialGroup() 106 | .addComponent(jLabel3) 107 | .addGap(531, 531, 531)) 108 | .addGroup(jPanel1Layout.createSequentialGroup() 109 | .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) 110 | .addComponent(jLabel2) 111 | .addComponent(jLabel1) 112 | .addComponent(jLabel4) 113 | .addComponent(jLabel5) 114 | .addComponent(jLabel7)) 115 | .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) 116 | .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) 117 | .addComponent(jT5Status) 118 | .addGroup(jPanel1Layout.createSequentialGroup() 119 | .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) 120 | .addComponent(jT3Edicao, javax.swing.GroupLayout.DEFAULT_SIZE, 98, Short.MAX_VALUE) 121 | .addComponent(jT0Id, javax.swing.GroupLayout.PREFERRED_SIZE, 97, javax.swing.GroupLayout.PREFERRED_SIZE) 122 | .addComponent(jT4Ano)) 123 | .addGap(0, 0, Short.MAX_VALUE)) 124 | .addComponent(jT1Exemplar) 125 | .addComponent(jT2Autor)) 126 | .addContainerGap()))) 127 | ); 128 | jPanel1Layout.setVerticalGroup( 129 | jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) 130 | .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup() 131 | .addContainerGap(32, Short.MAX_VALUE) 132 | .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) 133 | .addComponent(jLabel7) 134 | .addComponent(jT0Id, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) 135 | .addGap(18, 18, 18) 136 | .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) 137 | .addComponent(jLabel1) 138 | .addComponent(jT1Exemplar, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) 139 | .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) 140 | .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) 141 | .addComponent(jLabel2) 142 | .addComponent(jT2Autor, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) 143 | .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) 144 | .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) 145 | .addComponent(jLabel3) 146 | .addComponent(jT3Edicao, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) 147 | .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) 148 | .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) 149 | .addComponent(jLabel4) 150 | .addComponent(jT4Ano, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) 151 | .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) 152 | .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) 153 | .addComponent(jLabel5) 154 | .addComponent(jT5Status, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) 155 | .addGap(54, 54, 54)) 156 | ); 157 | 158 | jPanel2.setBorder(javax.swing.BorderFactory.createTitledBorder("Pesquisar Livros")); 159 | 160 | jBPesquisar.setText("Pesquisar"); 161 | jBPesquisar.addActionListener(new java.awt.event.ActionListener() { 162 | public void actionPerformed(java.awt.event.ActionEvent evt) { 163 | jBPesquisarActionPerformed(evt); 164 | } 165 | }); 166 | 167 | jTablePesquisa.setModel(tmLivro); 168 | jTablePesquisa.addMouseListener(new java.awt.event.MouseAdapter() { 169 | public void mouseClicked(java.awt.event.MouseEvent evt) { 170 | jTablePesquisaMouseClicked(evt); 171 | } 172 | }); 173 | jScrollPane1.setViewportView(jTablePesquisa); 174 | 175 | jLabel8.setText("Nome:"); 176 | 177 | javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2); 178 | jPanel2.setLayout(jPanel2Layout); 179 | jPanel2Layout.setHorizontalGroup( 180 | jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) 181 | .addGroup(jPanel2Layout.createSequentialGroup() 182 | .addContainerGap() 183 | .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) 184 | .addComponent(jScrollPane1) 185 | .addGroup(jPanel2Layout.createSequentialGroup() 186 | .addComponent(jLabel8) 187 | .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) 188 | .addComponent(jTPesquisar, javax.swing.GroupLayout.PREFERRED_SIZE, 415, javax.swing.GroupLayout.PREFERRED_SIZE) 189 | .addGap(49, 49, 49) 190 | .addComponent(jBPesquisar, javax.swing.GroupLayout.PREFERRED_SIZE, 126, javax.swing.GroupLayout.PREFERRED_SIZE))) 191 | .addContainerGap()) 192 | ); 193 | jPanel2Layout.setVerticalGroup( 194 | jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) 195 | .addGroup(jPanel2Layout.createSequentialGroup() 196 | .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) 197 | .addComponent(jBPesquisar, javax.swing.GroupLayout.PREFERRED_SIZE, 44, javax.swing.GroupLayout.PREFERRED_SIZE) 198 | .addComponent(jTPesquisar, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) 199 | .addComponent(jLabel8)) 200 | .addGap(8, 8, 8) 201 | .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 195, javax.swing.GroupLayout.PREFERRED_SIZE) 202 | .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) 203 | ); 204 | 205 | jPanel3.setBorder(javax.swing.BorderFactory.createEtchedBorder()); 206 | 207 | jBExcluir.setText("Excluir"); 208 | jBExcluir.addActionListener(new java.awt.event.ActionListener() { 209 | public void actionPerformed(java.awt.event.ActionEvent evt) { 210 | jBExcluirActionPerformed(evt); 211 | } 212 | }); 213 | 214 | jBAlterar.setText("Alterar"); 215 | jBAlterar.addActionListener(new java.awt.event.ActionListener() { 216 | public void actionPerformed(java.awt.event.ActionEvent evt) { 217 | jBAlterarActionPerformed(evt); 218 | } 219 | }); 220 | 221 | jBNovo.setText("Novo"); 222 | jBNovo.addActionListener(new java.awt.event.ActionListener() { 223 | public void actionPerformed(java.awt.event.ActionEvent evt) { 224 | jBNovoActionPerformed(evt); 225 | } 226 | }); 227 | 228 | jBCadastrar.setText("Cadastrar"); 229 | jBCadastrar.addActionListener(new java.awt.event.ActionListener() { 230 | public void actionPerformed(java.awt.event.ActionEvent evt) { 231 | jBCadastrarActionPerformed(evt); 232 | } 233 | }); 234 | 235 | jBSair.setText("Sair"); 236 | jBSair.addActionListener(new java.awt.event.ActionListener() { 237 | public void actionPerformed(java.awt.event.ActionEvent evt) { 238 | jBSairActionPerformed(evt); 239 | } 240 | }); 241 | 242 | javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3); 243 | jPanel3.setLayout(jPanel3Layout); 244 | jPanel3Layout.setHorizontalGroup( 245 | jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) 246 | .addGroup(jPanel3Layout.createSequentialGroup() 247 | .addContainerGap() 248 | .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) 249 | .addComponent(jBExcluir, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) 250 | .addComponent(jBAlterar, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) 251 | .addComponent(jBNovo, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) 252 | .addComponent(jBCadastrar, javax.swing.GroupLayout.DEFAULT_SIZE, 135, Short.MAX_VALUE) 253 | .addComponent(jBSair, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) 254 | .addContainerGap()) 255 | ); 256 | jPanel3Layout.setVerticalGroup( 257 | jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) 258 | .addGroup(jPanel3Layout.createSequentialGroup() 259 | .addContainerGap() 260 | .addComponent(jBExcluir, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE) 261 | .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) 262 | .addComponent(jBAlterar) 263 | .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) 264 | .addComponent(jBNovo) 265 | .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) 266 | .addComponent(jBCadastrar) 267 | .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 24, Short.MAX_VALUE) 268 | .addComponent(jBSair) 269 | .addContainerGap()) 270 | ); 271 | 272 | jPanel3Layout.linkSize(javax.swing.SwingConstants.VERTICAL, new java.awt.Component[] {jBAlterar, jBCadastrar, jBExcluir, jBNovo, jBSair}); 273 | 274 | javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); 275 | getContentPane().setLayout(layout); 276 | layout.setHorizontalGroup( 277 | layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) 278 | .addGroup(layout.createSequentialGroup() 279 | .addContainerGap() 280 | .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) 281 | .addComponent(jPanel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) 282 | .addGroup(layout.createSequentialGroup() 283 | .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) 284 | .addGap(18, 18, 18) 285 | .addComponent(jPanel3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))) 286 | .addContainerGap()) 287 | ); 288 | layout.setVerticalGroup( 289 | layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) 290 | .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() 291 | .addContainerGap() 292 | .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) 293 | .addGap(18, 18, 18) 294 | .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) 295 | .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) 296 | .addComponent(jPanel3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) 297 | .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) 298 | ); 299 | 300 | jPanel1.getAccessibleContext().setAccessibleName("Cadastro de Clientes"); 301 | 302 | pack(); 303 | setLocationRelativeTo(null); 304 | }// //GEN-END:initComponents 305 | 306 | // BOTÃO NOVO - Precionando 307 | private void jBNovoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jBNovoActionPerformed 308 | habilitaCampos(); 309 | // Limpa os dados dos campos 310 | limpaCampos(); 311 | }//GEN-LAST:event_jBNovoActionPerformed 312 | 313 | // BOTÃO CADASTRAR - Precionando 314 | private void jBCadastrarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jBCadastrarActionPerformed 315 | cadastraRegistro(); 316 | }//GEN-LAST:event_jBCadastrarActionPerformed 317 | 318 | // BOTÃO PESQUISAR - Precionando 319 | private void jBPesquisarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jBPesquisarActionPerformed 320 | // Ao clicar em pesquisar, é executado o método que efetua a pesquisa, e outro método que exibe a lista da pesquisa 321 | try { 322 | listaContatos(); 323 | } catch (SQLException ex) { 324 | JOptionPane.showMessageDialog(rootPane, "Problemas ao listar contatos."); 325 | } 326 | }//GEN-LAST:event_jBPesquisarActionPerformed 327 | 328 | // TABELA PESQUISA - Selecionando registro com o clique do mouse 329 | private void jTablePesquisaMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jTablePesquisaMouseClicked 330 | // Salva a posição da linha selecionada na tabela de pesquisa 331 | int linhaSelecionada = jTablePesquisa.getSelectedRow(); 332 | 333 | jT0Id.setText(jTablePesquisa.getValueAt(linhaSelecionada, 0).toString()); 334 | jT1Exemplar.setText((String) jTablePesquisa.getValueAt(linhaSelecionada, 1)); 335 | jT2Autor.setText((String) jTablePesquisa.getValueAt(linhaSelecionada, 2)); 336 | jT3Edicao.setText(jTablePesquisa.getValueAt(linhaSelecionada, 3).toString()); 337 | jT4Ano.setText(jTablePesquisa.getValueAt(linhaSelecionada, 4).toString()); 338 | jT5Status.setText((String) jTablePesquisa.getValueAt(linhaSelecionada, 5)); 339 | 340 | // Ao selecionar um registro, os campos são ativados possibilitando fazer alterações 341 | habilitaCampos(); 342 | }//GEN-LAST:event_jTablePesquisaMouseClicked 343 | 344 | // BOTÃO EXCLUIR - Precionando 345 | private void jBExcluirActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jBExcluirActionPerformed 346 | try { 347 | excluirRegistro(); 348 | } catch (SQLException ex) { 349 | JOptionPane.showMessageDialog(rootPane, "Erro ao excluir registro."); 350 | } 351 | }//GEN-LAST:event_jBExcluirActionPerformed 352 | 353 | // BOTÃO ALTERAR 354 | private void jBAlterarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jBAlterarActionPerformed 355 | try { 356 | alteraRegistro(); 357 | } catch (SQLException ex) { 358 | JOptionPane.showMessageDialog(rootPane, "Erro ao alterar registro."); 359 | } 360 | }//GEN-LAST:event_jBAlterarActionPerformed 361 | 362 | private void formWindowClosed(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_formWindowClosed 363 | 364 | telaPrincipal.setEnabled(true); 365 | 366 | }//GEN-LAST:event_formWindowClosed 367 | 368 | private void jBSairActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jBSairActionPerformed 369 | this.dispose(); 370 | }//GEN-LAST:event_jBSairActionPerformed 371 | 372 | 373 | 374 | 375 | /* ----CADASTRO-> */ 376 | // MÉTODOS: 377 | 378 | // Método p/ cadastrar um registro no banco de dados. 379 | private void cadastraRegistro() { 380 | // Antes de cadastrar, verifica se o usuário está com algum registro selecionado 381 | if (jT1Exemplar.isEditable() && jT0Id.getText().equals("")) { 382 | // Antes de cadastrar, verifica se os campos foram preenchidos 383 | if (verificaDados()) { 384 | try { 385 | Livro l = new Livro(); 386 | 387 | l.setExemplar(jT1Exemplar.getText()); 388 | l.setAutor(jT2Autor.getText()); 389 | l.setEdicao(Byte.valueOf(jT3Edicao.getText())); 390 | l.setAno(Short.valueOf(jT4Ano.getText())); 391 | l.setDisponibilidade(jT5Status.getText()); 392 | 393 | BdLivro d = new BdLivro(); 394 | 395 | d.adicionaLivro(l); 396 | 397 | JOptionPane.showMessageDialog(rootPane, "Dados cadastrados com sucesso."); 398 | limpaCampos(); 399 | desabilitaCampos(); 400 | 401 | } catch (SQLException ex) { 402 | JOptionPane.showMessageDialog(rootPane, "Erro ao cadastrar dados."); 403 | } 404 | } 405 | } else { 406 | JOptionPane.showMessageDialog(rootPane, "Para cadastrar um novo registro.\nClique em 'Novo'."); 407 | } 408 | } 409 | 410 | // Método p/ validação do formulário 411 | private boolean verificaDados() { 412 | if ((!jT1Exemplar.getText().equals("")) && (!jT2Autor.getText().equals("")) 413 | && (!jT3Edicao.getText().equals("")) && (!jT4Ano.getText().equals("")) 414 | && (!jT5Status.getText().equals(""))) { 415 | return true; 416 | } 417 | JOptionPane.showMessageDialog(rootPane, "Dados imcompletos."); 418 | return false; 419 | } 420 | 421 | /* <-CADASTRO---- */ 422 | 423 | 424 | 425 | 426 | /* ----PESQUISA-> */ 427 | // MÉTODOS: 428 | 429 | // Edita os campos e colunas da tabela de resultados 430 | DefaultTableModel tmLivro = new DefaultTableModel(null, new String[]{"Id", "Exemplar", "Autor", "Edição", "Ano", "Disponibilidade"}); 431 | List livros; 432 | 433 | // Lista a quantidade de resultado, de acordo com o nome passado no campo pesquisa 434 | private void listaContatos() throws SQLException { 435 | limpaCampos(); 436 | BdLivro d = new BdLivro(); 437 | livros = d.getLista("%" + jTPesquisar.getText() + "%"); 438 | 439 | // Após pesquisar os contatos, executa o método p/ exibir o resultado na tabela pesquisa 440 | mostraPesquisa(livros); 441 | livros.clear(); 442 | } 443 | 444 | // Mostra a lista de resultado de acordo com o nome passado no campo pesquisa 445 | private void mostraPesquisa(List livros) { 446 | // Limpa a tabela sempre que for solicitado uma nova pesquisa 447 | limparTabela(); 448 | 449 | if (livros.isEmpty()) { 450 | JOptionPane.showMessageDialog(rootPane, "Nenhum registro encontrado."); 451 | } else { 452 | // Linha em branco usada no for, para cada registro é criada uma nova linha 453 | String[] linha = new String[] {null, null, null, null, null, null, null}; 454 | // P/ cada registro é criada uma nova linha, cada linha recebe os campos do registro 455 | for (int i = 0; i < livros.size(); i++) { 456 | tmLivro.addRow(linha); 457 | tmLivro.setValueAt(livros.get(i).getId(), i, 0); 458 | tmLivro.setValueAt(livros.get(i).getExemplar(), i, 1); 459 | tmLivro.setValueAt(livros.get(i).getAutor(), i, 2); 460 | tmLivro.setValueAt(livros.get(i).getEdicao(), i, 3); 461 | tmLivro.setValueAt(livros.get(i).getAno(), i, 4); 462 | tmLivro.setValueAt(livros.get(i).getDisponibilidade(), i, 5); 463 | } 464 | } 465 | } 466 | 467 | // Limpa a tabela de resultados 468 | private void limparTabela() { 469 | while (tmLivro.getRowCount() > 0) { 470 | tmLivro.removeRow(0); 471 | } 472 | } 473 | /* Outra opção de limpar tabelas 474 | private void limparTabela() { 475 | while (tmLivro.getRowCount() > 0) { 476 | tmLivro.getDataVector().removeAllElements(); 477 | } 478 | } 479 | */ 480 | /* <-PESQUISA---- */ 481 | 482 | 483 | 484 | /* ----EXCLUIR-> */ 485 | // MÉTODOS: 486 | 487 | // Exclui resgistro 488 | private void excluirRegistro() throws SQLException { 489 | // Se algum registro estiver selecionado 490 | if (jTablePesquisa.getSelectedRow() != -1) { 491 | // Exibe uma janela de confirmação antes de exluir o registro 492 | int resp = JOptionPane.showConfirmDialog(rootPane, "Deseja realmente excluir este registro?", 493 | "Confirmação!", JOptionPane.YES_NO_OPTION); 494 | 495 | // Se a confirmação for SIM 496 | if (resp == JOptionPane.YES_NO_OPTION) { 497 | // Recebe a linha selecionada 498 | int linhaSelecionada = jTablePesquisa.getSelectedRow(); 499 | // Recebe o ID da linha selecionada 500 | int id = (int) jTablePesquisa.getValueAt(linhaSelecionada, 0); 501 | // Remove o registro, usando como parâmetro, o id da linha selecionada 502 | BdLivro d = new BdLivro(); 503 | d.remove(id); 504 | 505 | JOptionPane.showMessageDialog(rootPane, "Registro excluido com sucesso."); 506 | limpaCampos(); 507 | desabilitaCampos(); 508 | } 509 | } else { 510 | JOptionPane.showMessageDialog(rootPane, "Registro não selecionado."); 511 | } 512 | } 513 | /* <-EXCLUIR---- */ 514 | 515 | 516 | 517 | 518 | /* ----ALTERAR-> */ 519 | // MÉTODOS: 520 | 521 | // Altera registro 522 | private void alteraRegistro() throws SQLException { 523 | if (jTablePesquisa.getSelectedRow() != -1) { 524 | int resp = JOptionPane.showConfirmDialog(rootPane, "Deseja realmente alterar este registro?", 525 | "Confirmação!", JOptionPane.YES_NO_OPTION); 526 | 527 | // Se a confirmação for SIM 528 | if (resp == JOptionPane.YES_NO_OPTION) { 529 | Livro l = new Livro(); 530 | BdLivro d = new BdLivro(); 531 | 532 | l.setId(Integer.valueOf(jT0Id.getText())); 533 | l.setExemplar(jT1Exemplar.getText()); 534 | l.setAutor(jT2Autor.getText()); 535 | l.setEdicao(Byte.valueOf(jT3Edicao.getText())); 536 | l.setAno(Short.valueOf(jT4Ano.getText())); 537 | l.setDisponibilidade(jT5Status.getText()); 538 | 539 | d.altera(l); 540 | 541 | JOptionPane.showMessageDialog(rootPane, "Registro alterado com sucesso."); 542 | limpaCampos(); 543 | desabilitaCampos(); 544 | listaContatos(); 545 | } 546 | } else { 547 | JOptionPane.showMessageDialog(rootPane, "Registro não selecionado."); 548 | } 549 | } 550 | /* <-ALTERAR---- */ 551 | 552 | 553 | 554 | 555 | /* ----OUTROS-> */ 556 | // MÉTODOS: 557 | 558 | // Limpa os campos do formulário 559 | private void limpaCampos() { 560 | jT0Id.setText(""); 561 | jT1Exemplar.setText(""); 562 | jT2Autor.setText(""); 563 | jT3Edicao.setText(""); 564 | jT4Ano.setText(""); 565 | jT5Status.setText(""); 566 | } 567 | 568 | // Desabilita os campos do formulário 569 | private void desabilitaCampos() { 570 | jT0Id.setEditable(false); 571 | jT1Exemplar.setEditable(false); 572 | jT2Autor.setEditable(false); 573 | jT3Edicao.setEditable(false); 574 | jT4Ano.setEditable(false); 575 | jT5Status.setEditable(false); 576 | } 577 | 578 | // Habilita os campos do formulário 579 | private void habilitaCampos() { 580 | 581 | jT1Exemplar.setEditable(true); 582 | jT2Autor.setEditable(true); 583 | jT3Edicao.setEditable(true); 584 | jT4Ano.setEditable(true); 585 | jT5Status.setEditable(true); 586 | } 587 | 588 | /* <-OUTROS---- */ 589 | 590 | 591 | 592 | 593 | /** 594 | * @param args the command line arguments 595 | */ 596 | public static void main(String args[]) { 597 | /* Set the Nimbus look and feel */ 598 | // 599 | /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel. 600 | * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html 601 | */ 602 | try { 603 | for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) { 604 | if ("Nimbus".equals(info.getName())) { 605 | javax.swing.UIManager.setLookAndFeel(info.getClassName()); 606 | break; 607 | } 608 | } 609 | } catch (ClassNotFoundException ex) { 610 | java.util.logging.Logger.getLogger(JFLivro.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); 611 | } catch (InstantiationException ex) { 612 | java.util.logging.Logger.getLogger(JFLivro.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); 613 | } catch (IllegalAccessException ex) { 614 | java.util.logging.Logger.getLogger(JFLivro.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); 615 | } catch (javax.swing.UnsupportedLookAndFeelException ex) { 616 | java.util.logging.Logger.getLogger(JFLivro.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); 617 | } 618 | // 619 | // 620 | // 621 | // 622 | 623 | /* Create and display the form */ 624 | java.awt.EventQueue.invokeLater(new Runnable() { 625 | public void run() { 626 | new JFLivro().setVisible(true); 627 | } 628 | }); 629 | } 630 | 631 | 632 | // Variables declaration - do not modify//GEN-BEGIN:variables 633 | private javax.swing.JButton jBAlterar; 634 | private javax.swing.JButton jBCadastrar; 635 | private javax.swing.JButton jBExcluir; 636 | private javax.swing.JButton jBNovo; 637 | private javax.swing.JButton jBPesquisar; 638 | private javax.swing.JButton jBSair; 639 | private javax.swing.JLabel jLabel1; 640 | private javax.swing.JLabel jLabel2; 641 | private javax.swing.JLabel jLabel3; 642 | private javax.swing.JLabel jLabel4; 643 | private javax.swing.JLabel jLabel5; 644 | private javax.swing.JLabel jLabel7; 645 | private javax.swing.JLabel jLabel8; 646 | private javax.swing.JPanel jPanel1; 647 | private javax.swing.JPanel jPanel2; 648 | private javax.swing.JPanel jPanel3; 649 | private javax.swing.JScrollPane jScrollPane1; 650 | private javax.swing.JTextField jT0Id; 651 | private javax.swing.JTextField jT1Exemplar; 652 | private javax.swing.JTextField jT2Autor; 653 | private javax.swing.JTextField jT3Edicao; 654 | private javax.swing.JTextField jT4Ano; 655 | private javax.swing.JTextField jT5Status; 656 | private javax.swing.JTextField jTPesquisar; 657 | private javax.swing.JTable jTablePesquisa; 658 | // End of variables declaration//GEN-END:variables 659 | 660 | } 661 | -------------------------------------------------------------------------------- /src/view/JFCliente.java: -------------------------------------------------------------------------------- 1 | /* 2 | * To change this license header, choose License Headers in Project Properties. 3 | * To change this template file, choose Tools | Templates 4 | * and open the template in the editor. 5 | */ 6 | package view; 7 | 8 | import java.sql.SQLException; 9 | import java.util.List; 10 | import javax.swing.JOptionPane; 11 | import javax.swing.table.DefaultTableModel; 12 | import model.Cliente; 13 | import utils.BdCliente; 14 | 15 | 16 | /** 17 | * 18 | * @author paulojp 19 | */ 20 | public class JFCliente extends javax.swing.JFrame { 21 | 22 | // Variável que recebe a instância da tela principal 23 | private JFPrincipal telaPrincipal; 24 | 25 | /** 26 | * Creates new form Cliente 27 | */ 28 | public JFCliente() { 29 | initComponents(); 30 | 31 | // Desabilita os campos ao iniciar a janela 32 | desabilitaCampos(); 33 | } 34 | 35 | // Construtor reabilita tela principal - recebe a instância 36 | JFCliente(JFPrincipal telaPrincipal) { 37 | 38 | // this(esta janela 'jFCliente') - abre a própria janela ao execultar o contrutor 39 | this(); 40 | 41 | this.telaPrincipal = telaPrincipal; 42 | 43 | } 44 | 45 | /** 46 | * This method is called from within the constructor to initialize the form. 47 | * WARNING: Do NOT modify this code. The content of this method is always 48 | * regenerated by the Form Editor. 49 | */ 50 | @SuppressWarnings("unchecked") 51 | // //GEN-BEGIN:initComponents 52 | private void initComponents() { 53 | 54 | jPanel1 = new javax.swing.JPanel(); 55 | jLabel1 = new javax.swing.JLabel(); 56 | jLabel2 = new javax.swing.JLabel(); 57 | jLabel3 = new javax.swing.JLabel(); 58 | jLabel4 = new javax.swing.JLabel(); 59 | jLabel5 = new javax.swing.JLabel(); 60 | jLabel6 = new javax.swing.JLabel(); 61 | jLabel7 = new javax.swing.JLabel(); 62 | jT1Nome = new javax.swing.JTextField(); 63 | jT2DataAno = new javax.swing.JTextField(); 64 | jT3Sexo = new javax.swing.JTextField(); 65 | jT4Cpf = new javax.swing.JTextField(); 66 | jT5Endereco = new javax.swing.JTextField(); 67 | jT6Fone = new javax.swing.JTextField(); 68 | jT0Id = new javax.swing.JTextField(); 69 | jT2DataDia = new javax.swing.JTextField(); 70 | jT2DataMes = new javax.swing.JTextField(); 71 | jLabel9 = new javax.swing.JLabel(); 72 | jLabel10 = new javax.swing.JLabel(); 73 | jPanel2 = new javax.swing.JPanel(); 74 | jTPesquisar = new javax.swing.JTextField(); 75 | jBPesquisar = new javax.swing.JButton(); 76 | jScrollPane1 = new javax.swing.JScrollPane(); 77 | jTablePesquisa = new javax.swing.JTable(); 78 | jLabel8 = new javax.swing.JLabel(); 79 | jPanel3 = new javax.swing.JPanel(); 80 | jBExcluir = new javax.swing.JButton(); 81 | jBAlterar = new javax.swing.JButton(); 82 | jBNovo = new javax.swing.JButton(); 83 | jBCadastrar = new javax.swing.JButton(); 84 | jBSair = new javax.swing.JButton(); 85 | 86 | setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE); 87 | setTitle("Dados dos Clientes"); 88 | addWindowListener(new java.awt.event.WindowAdapter() { 89 | public void windowClosed(java.awt.event.WindowEvent evt) { 90 | formWindowClosed(evt); 91 | } 92 | }); 93 | 94 | jPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder("Dados Clientes")); 95 | 96 | jLabel1.setText("Nome:"); 97 | 98 | jLabel2.setText("Data de Nascimento: "); 99 | 100 | jLabel3.setText("Sexo: "); 101 | 102 | jLabel4.setText("Cpf: "); 103 | 104 | jLabel5.setText("Endereço: "); 105 | 106 | jLabel6.setText("Fone: "); 107 | 108 | jLabel7.setText("ID: "); 109 | 110 | jLabel9.setText("/"); 111 | 112 | jLabel10.setText("/"); 113 | 114 | javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1); 115 | jPanel1.setLayout(jPanel1Layout); 116 | jPanel1Layout.setHorizontalGroup( 117 | jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) 118 | .addGroup(jPanel1Layout.createSequentialGroup() 119 | .addContainerGap() 120 | .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) 121 | .addGroup(jPanel1Layout.createSequentialGroup() 122 | .addComponent(jLabel3) 123 | .addGap(519, 519, 519)) 124 | .addGroup(jPanel1Layout.createSequentialGroup() 125 | .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) 126 | .addComponent(jLabel2) 127 | .addComponent(jLabel1) 128 | .addComponent(jLabel4) 129 | .addComponent(jLabel5) 130 | .addComponent(jLabel6) 131 | .addComponent(jLabel7)) 132 | .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) 133 | .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) 134 | .addComponent(jT5Endereco) 135 | .addGroup(jPanel1Layout.createSequentialGroup() 136 | .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) 137 | .addComponent(jT6Fone, javax.swing.GroupLayout.PREFERRED_SIZE, 189, javax.swing.GroupLayout.PREFERRED_SIZE) 138 | .addComponent(jT1Nome, javax.swing.GroupLayout.PREFERRED_SIZE, 400, javax.swing.GroupLayout.PREFERRED_SIZE) 139 | .addComponent(jT0Id, javax.swing.GroupLayout.PREFERRED_SIZE, 97, javax.swing.GroupLayout.PREFERRED_SIZE) 140 | .addGroup(jPanel1Layout.createSequentialGroup() 141 | .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) 142 | .addComponent(jT3Sexo, javax.swing.GroupLayout.PREFERRED_SIZE, 98, javax.swing.GroupLayout.PREFERRED_SIZE) 143 | .addGroup(jPanel1Layout.createSequentialGroup() 144 | .addComponent(jT2DataDia, javax.swing.GroupLayout.PREFERRED_SIZE, 37, javax.swing.GroupLayout.PREFERRED_SIZE) 145 | .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) 146 | .addComponent(jLabel9, javax.swing.GroupLayout.PREFERRED_SIZE, 15, javax.swing.GroupLayout.PREFERRED_SIZE) 147 | .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) 148 | .addComponent(jT2DataMes, javax.swing.GroupLayout.PREFERRED_SIZE, 37, javax.swing.GroupLayout.PREFERRED_SIZE))) 149 | .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) 150 | .addComponent(jLabel10, javax.swing.GroupLayout.PREFERRED_SIZE, 15, javax.swing.GroupLayout.PREFERRED_SIZE) 151 | .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) 152 | .addComponent(jT2DataAno, javax.swing.GroupLayout.PREFERRED_SIZE, 65, javax.swing.GroupLayout.PREFERRED_SIZE)) 153 | .addComponent(jT4Cpf, javax.swing.GroupLayout.PREFERRED_SIZE, 190, javax.swing.GroupLayout.PREFERRED_SIZE)) 154 | .addGap(0, 0, Short.MAX_VALUE))))) 155 | .addContainerGap()) 156 | ); 157 | 158 | jPanel1Layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {jT2DataDia, jT2DataMes}); 159 | 160 | jPanel1Layout.setVerticalGroup( 161 | jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) 162 | .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup() 163 | .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) 164 | .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) 165 | .addComponent(jLabel7) 166 | .addComponent(jT0Id, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) 167 | .addGap(18, 18, 18) 168 | .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) 169 | .addComponent(jLabel1) 170 | .addComponent(jT1Nome, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) 171 | .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) 172 | .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) 173 | .addComponent(jLabel2) 174 | .addComponent(jT2DataAno, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) 175 | .addComponent(jT2DataDia, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) 176 | .addComponent(jT2DataMes, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) 177 | .addComponent(jLabel9) 178 | .addComponent(jLabel10)) 179 | .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) 180 | .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) 181 | .addComponent(jLabel3) 182 | .addComponent(jT3Sexo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) 183 | .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) 184 | .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) 185 | .addComponent(jLabel4) 186 | .addComponent(jT4Cpf, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) 187 | .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) 188 | .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) 189 | .addComponent(jLabel5) 190 | .addComponent(jT5Endereco, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) 191 | .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) 192 | .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) 193 | .addComponent(jLabel6) 194 | .addComponent(jT6Fone, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) 195 | .addContainerGap()) 196 | ); 197 | 198 | jPanel2.setBorder(javax.swing.BorderFactory.createTitledBorder("Pesquisar Cliente")); 199 | 200 | jBPesquisar.setText("Pesquisar"); 201 | jBPesquisar.addActionListener(new java.awt.event.ActionListener() { 202 | public void actionPerformed(java.awt.event.ActionEvent evt) { 203 | jBPesquisarActionPerformed(evt); 204 | } 205 | }); 206 | 207 | jTablePesquisa.setModel(tmCliente); 208 | jTablePesquisa.addMouseListener(new java.awt.event.MouseAdapter() { 209 | public void mouseClicked(java.awt.event.MouseEvent evt) { 210 | jTablePesquisaMouseClicked(evt); 211 | } 212 | }); 213 | jScrollPane1.setViewportView(jTablePesquisa); 214 | 215 | jLabel8.setText("Nome:"); 216 | 217 | javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2); 218 | jPanel2.setLayout(jPanel2Layout); 219 | jPanel2Layout.setHorizontalGroup( 220 | jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) 221 | .addGroup(jPanel2Layout.createSequentialGroup() 222 | .addContainerGap() 223 | .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) 224 | .addComponent(jScrollPane1) 225 | .addGroup(jPanel2Layout.createSequentialGroup() 226 | .addComponent(jLabel8) 227 | .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) 228 | .addComponent(jTPesquisar, javax.swing.GroupLayout.PREFERRED_SIZE, 415, javax.swing.GroupLayout.PREFERRED_SIZE) 229 | .addGap(49, 49, 49) 230 | .addComponent(jBPesquisar, javax.swing.GroupLayout.PREFERRED_SIZE, 126, javax.swing.GroupLayout.PREFERRED_SIZE))) 231 | .addContainerGap()) 232 | ); 233 | jPanel2Layout.setVerticalGroup( 234 | jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) 235 | .addGroup(jPanel2Layout.createSequentialGroup() 236 | .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) 237 | .addComponent(jBPesquisar, javax.swing.GroupLayout.PREFERRED_SIZE, 44, javax.swing.GroupLayout.PREFERRED_SIZE) 238 | .addComponent(jTPesquisar, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) 239 | .addComponent(jLabel8)) 240 | .addGap(8, 8, 8) 241 | .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 195, javax.swing.GroupLayout.PREFERRED_SIZE) 242 | .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) 243 | ); 244 | 245 | jPanel3.setBorder(javax.swing.BorderFactory.createEtchedBorder()); 246 | 247 | jBExcluir.setText("Excluir"); 248 | jBExcluir.addActionListener(new java.awt.event.ActionListener() { 249 | public void actionPerformed(java.awt.event.ActionEvent evt) { 250 | jBExcluirActionPerformed(evt); 251 | } 252 | }); 253 | 254 | jBAlterar.setText("Alterar"); 255 | jBAlterar.addActionListener(new java.awt.event.ActionListener() { 256 | public void actionPerformed(java.awt.event.ActionEvent evt) { 257 | jBAlterarActionPerformed(evt); 258 | } 259 | }); 260 | 261 | jBNovo.setText("Novo"); 262 | jBNovo.addActionListener(new java.awt.event.ActionListener() { 263 | public void actionPerformed(java.awt.event.ActionEvent evt) { 264 | jBNovoActionPerformed(evt); 265 | } 266 | }); 267 | 268 | jBCadastrar.setText("Cadastrar"); 269 | jBCadastrar.addActionListener(new java.awt.event.ActionListener() { 270 | public void actionPerformed(java.awt.event.ActionEvent evt) { 271 | jBCadastrarActionPerformed(evt); 272 | } 273 | }); 274 | 275 | jBSair.setText("Sair"); 276 | jBSair.addActionListener(new java.awt.event.ActionListener() { 277 | public void actionPerformed(java.awt.event.ActionEvent evt) { 278 | jBSairActionPerformed(evt); 279 | } 280 | }); 281 | 282 | javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3); 283 | jPanel3.setLayout(jPanel3Layout); 284 | jPanel3Layout.setHorizontalGroup( 285 | jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) 286 | .addGroup(jPanel3Layout.createSequentialGroup() 287 | .addContainerGap() 288 | .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) 289 | .addComponent(jBExcluir, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) 290 | .addComponent(jBAlterar, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) 291 | .addComponent(jBNovo, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) 292 | .addComponent(jBCadastrar, javax.swing.GroupLayout.DEFAULT_SIZE, 135, Short.MAX_VALUE) 293 | .addComponent(jBSair, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) 294 | .addContainerGap()) 295 | ); 296 | jPanel3Layout.setVerticalGroup( 297 | jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) 298 | .addGroup(jPanel3Layout.createSequentialGroup() 299 | .addContainerGap() 300 | .addComponent(jBExcluir, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE) 301 | .addGap(18, 18, 18) 302 | .addComponent(jBAlterar) 303 | .addGap(18, 18, 18) 304 | .addComponent(jBNovo) 305 | .addGap(18, 18, 18) 306 | .addComponent(jBCadastrar) 307 | .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 44, Short.MAX_VALUE) 308 | .addComponent(jBSair) 309 | .addContainerGap()) 310 | ); 311 | 312 | jPanel3Layout.linkSize(javax.swing.SwingConstants.VERTICAL, new java.awt.Component[] {jBAlterar, jBCadastrar, jBExcluir, jBNovo, jBSair}); 313 | 314 | javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); 315 | getContentPane().setLayout(layout); 316 | layout.setHorizontalGroup( 317 | layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) 318 | .addGroup(layout.createSequentialGroup() 319 | .addContainerGap() 320 | .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) 321 | .addComponent(jPanel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) 322 | .addGroup(layout.createSequentialGroup() 323 | .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) 324 | .addGap(18, 18, 18) 325 | .addComponent(jPanel3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))) 326 | .addContainerGap()) 327 | ); 328 | layout.setVerticalGroup( 329 | layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) 330 | .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() 331 | .addContainerGap() 332 | .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) 333 | .addGap(22, 22, 22) 334 | .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) 335 | .addComponent(jPanel3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) 336 | .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) 337 | .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) 338 | ); 339 | 340 | jPanel1.getAccessibleContext().setAccessibleName("Cadastro de Clientes"); 341 | 342 | pack(); 343 | setLocationRelativeTo(null); 344 | }// //GEN-END:initComponents 345 | 346 | // BOTÃO NOVO - Precionando 347 | private void jBNovoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jBNovoActionPerformed 348 | habilitaCampos(); 349 | // Limpa os dados dos campos 350 | limpaCampos(); 351 | }//GEN-LAST:event_jBNovoActionPerformed 352 | 353 | // BOTÃO CADASTRAR - Precionando 354 | private void jBCadastrarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jBCadastrarActionPerformed 355 | cadastraRegistro(); 356 | }//GEN-LAST:event_jBCadastrarActionPerformed 357 | 358 | // BOTÃO PESQUISAR - Precionando 359 | private void jBPesquisarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jBPesquisarActionPerformed 360 | // Ao clicar em pesquisar, é executado o método que efetua a pesquisa, e outro método que exibe a lista da pesquisa 361 | try { 362 | listaContatos(); 363 | } catch (SQLException ex) { 364 | JOptionPane.showMessageDialog(rootPane, "Problemas ao listar contatos."); 365 | } 366 | }//GEN-LAST:event_jBPesquisarActionPerformed 367 | 368 | // TABELA PESQUISA - Selecionando registro com o clique do mouse 369 | private void jTablePesquisaMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jTablePesquisaMouseClicked 370 | // Salva a posição da linha selecionada na tabela de pesquisa 371 | int linhaSelecionada = jTablePesquisa.getSelectedRow(); 372 | 373 | jT0Id.setText(jTablePesquisa.getValueAt(linhaSelecionada, 0).toString()); 374 | jT1Nome.setText((String) jTablePesquisa.getValueAt(linhaSelecionada, 1)); 375 | jT2DataAno.setText((String) jTablePesquisa.getValueAt(linhaSelecionada, 2)); 376 | jT3Sexo.setText((String) jTablePesquisa.getValueAt(linhaSelecionada, 3)); 377 | jT4Cpf.setText((String) jTablePesquisa.getValueAt(linhaSelecionada, 4)); 378 | jT5Endereco.setText((String) jTablePesquisa.getValueAt(linhaSelecionada, 5)); 379 | jT6Fone.setText((String) jTablePesquisa.getValueAt(linhaSelecionada, 6)); 380 | 381 | // Ao selecionar um registro, os campos são ativados possibilitando fazer alterações 382 | habilitaCampos(); 383 | }//GEN-LAST:event_jTablePesquisaMouseClicked 384 | 385 | // BOTÃO EXCLUIR - Precionando 386 | private void jBExcluirActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jBExcluirActionPerformed 387 | try { 388 | excluirRegistro(); 389 | } catch (SQLException ex) { 390 | JOptionPane.showMessageDialog(rootPane, "Erro ao excluir registro."); 391 | } 392 | }//GEN-LAST:event_jBExcluirActionPerformed 393 | 394 | private void jBAlterarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jBAlterarActionPerformed 395 | try { 396 | alteraRegistro(); 397 | } catch (SQLException ex) { 398 | JOptionPane.showMessageDialog(rootPane, "Erro ao alterar registro."); 399 | } 400 | }//GEN-LAST:event_jBAlterarActionPerformed 401 | 402 | private void formWindowClosed(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_formWindowClosed 403 | 404 | // habilita a janela principal 405 | telaPrincipal.setEnabled(true); 406 | 407 | }//GEN-LAST:event_formWindowClosed 408 | 409 | private void jBSairActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jBSairActionPerformed 410 | this.dispose(); 411 | }//GEN-LAST:event_jBSairActionPerformed 412 | 413 | 414 | 415 | 416 | /* ----CADASTRO-> */ 417 | // MÉTODOS: 418 | 419 | // Método p/ cadastrar um registro no banco de dados. 420 | private void cadastraRegistro() { 421 | // Antes de cadastrar, verifica se o usuário está com algum registro selecionado 422 | if (jT1Nome.isEditable() && jT0Id.getText().equals("")) { 423 | // Antes de cadastrar, verifica se os campos foram preenchidos 424 | if (verificaDados()) { 425 | try { 426 | Cliente c = new Cliente(); 427 | 428 | c.setNome(jT1Nome.getText()); 429 | c.setDataNasc(data()); 430 | c.setSexo(jT3Sexo.getText()); 431 | c.setCpf(jT4Cpf.getText()); 432 | c.setEndereco(jT5Endereco.getText()); 433 | c.setFone(jT6Fone.getText()); 434 | 435 | BdCliente d = new BdCliente(); 436 | 437 | d.adicionaCliente(c); 438 | 439 | JOptionPane.showMessageDialog(rootPane, "Dados cadastrados com sucesso."); 440 | limpaCampos(); 441 | desabilitaCampos(); 442 | 443 | } catch (SQLException ex) { 444 | JOptionPane.showMessageDialog(rootPane, "Erro ao cadastrar cliente."); 445 | } 446 | } 447 | } else { 448 | JOptionPane.showMessageDialog(rootPane, "Para cadastrar um novo registro.\nClique em 'Novo'."); 449 | } 450 | } 451 | 452 | // Método p/ validação do formulário 453 | private boolean verificaDados() { 454 | if ((!jT1Nome.getText().equals("")) && (!jT2DataAno.getText().equals("")) 455 | && (!jT3Sexo.getText().equals("")) && (!jT4Cpf.getText().equals("")) 456 | && (!jT5Endereco.getText().equals(""))) { 457 | return true; 458 | } 459 | JOptionPane.showMessageDialog(rootPane, "Dados imcompletos."); 460 | return false; 461 | } 462 | 463 | // Método p/ concatenar a data 464 | private String data() { 465 | String d = jT2DataAno.getText() + "-" + jT2DataMes.getText() + "-" + jT2DataDia.getText(); 466 | 467 | return d; 468 | } 469 | /* <-CADASTRO---- */ 470 | 471 | 472 | 473 | 474 | /* ----PESQUISA-> */ 475 | // MÉTODOS: 476 | 477 | // Edita os campos e colunas da tabela de resultados 478 | DefaultTableModel tmCliente = new DefaultTableModel(null, new String[]{"Id", "Nome", "Data Nasc.", "Sexo", "CPF", "Endereço", "Fone"}); 479 | List clientes; 480 | 481 | 482 | // Lista a quantidade de resultado, de acordo com o nome passado no campo pesquisa 483 | private void listaContatos() throws SQLException { 484 | limpaCampos(); 485 | BdCliente d = new BdCliente(); 486 | clientes = d.getLista("%" + jTPesquisar.getText() + "%"); 487 | 488 | // Após pesquisar os contatos, executa o método p/ exibir o resultado na tabela pesquisa 489 | mostraPesquisa(clientes); 490 | clientes.clear(); 491 | } 492 | 493 | // Mostra a lista de resultado de acordo com o nome passado no campo pesquisa 494 | private void mostraPesquisa(List clientes) { 495 | // Limpa a tabela sempre que for solicitado uma nova pesquisa 496 | limparTabela(); 497 | 498 | if (clientes.isEmpty()) { 499 | JOptionPane.showMessageDialog(rootPane, "Nenhum registro não encontrado."); 500 | } else { 501 | // Linha em branco usada no for, para cada registro é criada uma nova linha 502 | String[] linha = new String[] {null, null, null, null, null, null, null}; 503 | // P/ cada registro é criada uma nova linha, cada recebe linha os campos do registro 504 | for (int i = 0; i < clientes.size(); i++) { 505 | tmCliente.addRow(linha); 506 | tmCliente.setValueAt(clientes.get(i).getId(), i, 0); 507 | tmCliente.setValueAt(clientes.get(i).getNome(), i, 1); 508 | tmCliente.setValueAt(clientes.get(i).getDataNasc(), i, 2); 509 | tmCliente.setValueAt(clientes.get(i).getSexo(), i, 3); 510 | tmCliente.setValueAt(clientes.get(i).getCpf(), i, 4); 511 | tmCliente.setValueAt(clientes.get(i).getEndereco(), i, 5); 512 | tmCliente.setValueAt(clientes.get(i).getFone(), i, 6); 513 | } 514 | } 515 | } 516 | 517 | // Limpa a tabela de resultados 518 | private void limparTabela() { 519 | while (tmCliente.getRowCount() > 0) { 520 | tmCliente.removeRow(0); 521 | } 522 | } 523 | /* <-PESQUISA---- */ 524 | 525 | 526 | 527 | /* ----EXCLUIR-> */ 528 | // MÉTODOS: 529 | 530 | // Exclui resgistro 531 | private void excluirRegistro() throws SQLException { 532 | // Se algum registro estiver selecionado 533 | if (jTablePesquisa.getSelectedRow() != -1) { 534 | // Exibe uma janela de confirmação antes de exluir o registro 535 | int resp = JOptionPane.showConfirmDialog(rootPane, "Deseja realmente excluir este registro?", 536 | "Confirmação!", JOptionPane.YES_NO_OPTION); 537 | 538 | // Se a confirmação for SIM 539 | if (resp == JOptionPane.YES_NO_OPTION) { 540 | // Recebe a linha selecionada 541 | int linhaSelecionada = jTablePesquisa.getSelectedRow(); 542 | // Recebe o ID da linha selecionada 543 | int id = (int) jTablePesquisa.getValueAt(linhaSelecionada, 0); 544 | // Remove o registro, usando como parâmetro, o id da linha selecionada 545 | BdCliente d = new BdCliente(); 546 | d.remove(id); 547 | 548 | JOptionPane.showMessageDialog(rootPane, "Registro excluido com sucesso."); 549 | limpaCampos(); 550 | desabilitaCampos(); 551 | } 552 | } else { 553 | JOptionPane.showMessageDialog(rootPane, "Registro não selecionado."); 554 | } 555 | } 556 | /* <-EXCLUIR---- */ 557 | 558 | 559 | 560 | 561 | /* ----ALTERAR-> */ 562 | // MÉTODOS: 563 | 564 | // Altera registro 565 | private void alteraRegistro() throws SQLException { 566 | if (jTablePesquisa.getSelectedRow() != -1) { 567 | int resp = JOptionPane.showConfirmDialog(rootPane, "Deseja realmente alterar este registro?", 568 | "Confirmação!", JOptionPane.YES_NO_OPTION); 569 | 570 | // Se a confirmação for SIM 571 | if (resp == JOptionPane.YES_NO_OPTION) { 572 | Cliente c = new Cliente(); 573 | BdCliente d = new BdCliente(); 574 | 575 | c.setId(Integer.valueOf(jT0Id.getText())); 576 | c.setNome(jT1Nome.getText()); 577 | c.setDataNasc(jT2DataAno.getText()); 578 | c.setSexo(jT3Sexo.getText()); 579 | c.setCpf(jT4Cpf.getText()); 580 | c.setEndereco(jT5Endereco.getText()); 581 | c.setFone(jT6Fone.getText()); 582 | 583 | d.altera(c); 584 | 585 | JOptionPane.showMessageDialog(rootPane, "Registro alterado com sucesso."); 586 | limpaCampos(); 587 | desabilitaCampos(); 588 | listaContatos(); 589 | } 590 | } else { 591 | JOptionPane.showMessageDialog(rootPane, "Registro não selecionado."); 592 | } 593 | } 594 | /* <-ALTERAR---- */ 595 | 596 | 597 | 598 | 599 | /* ----OUTROS-> */ 600 | // MÉTODOS: 601 | 602 | // Limpa os campos do formulário 603 | private void limpaCampos() { 604 | jT0Id.setText(""); 605 | jT1Nome.setText(""); 606 | jT2DataAno.setText(""); 607 | jT3Sexo.setText(""); 608 | jT4Cpf.setText(""); 609 | jT5Endereco.setText(""); 610 | jT6Fone.setText(""); 611 | } 612 | 613 | // Desabilita os campos do formulário 614 | private void desabilitaCampos() { 615 | jT0Id.setEditable(false); 616 | jT1Nome.setEditable(false); 617 | jT2DataAno.setEditable(false); 618 | jT3Sexo.setEditable(false); 619 | jT4Cpf.setEditable(false); 620 | jT5Endereco.setEditable(false); 621 | jT6Fone.setEditable(false); 622 | } 623 | 624 | // Habilita os campos do formulário 625 | private void habilitaCampos() { 626 | 627 | jT1Nome.setEditable(true); 628 | jT2DataAno.setEditable(true); 629 | jT3Sexo.setEditable(true); 630 | jT4Cpf.setEditable(true); 631 | jT5Endereco.setEditable(true); 632 | jT6Fone.setEditable(true); 633 | } 634 | 635 | /* <-OUTROS---- */ 636 | 637 | 638 | 639 | 640 | /** 641 | * @param args the command line arguments 642 | */ 643 | public static void main(String args[]) { 644 | /* Set the Nimbus look and feel */ 645 | // 646 | /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel. 647 | * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html 648 | */ 649 | try { 650 | for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) { 651 | if ("Nimbus".equals(info.getName())) { 652 | javax.swing.UIManager.setLookAndFeel(info.getClassName()); 653 | break; 654 | } 655 | } 656 | } catch (ClassNotFoundException ex) { 657 | java.util.logging.Logger.getLogger(JFCliente.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); 658 | } catch (InstantiationException ex) { 659 | java.util.logging.Logger.getLogger(JFCliente.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); 660 | } catch (IllegalAccessException ex) { 661 | java.util.logging.Logger.getLogger(JFCliente.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); 662 | } catch (javax.swing.UnsupportedLookAndFeelException ex) { 663 | java.util.logging.Logger.getLogger(JFCliente.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); 664 | } 665 | // 666 | // 667 | 668 | /* Create and display the form */ 669 | java.awt.EventQueue.invokeLater(new Runnable() { 670 | @Override 671 | public void run() { 672 | new JFCliente().setVisible(true); 673 | } 674 | }); 675 | } 676 | 677 | 678 | // Variables declaration - do not modify//GEN-BEGIN:variables 679 | private javax.swing.JButton jBAlterar; 680 | private javax.swing.JButton jBCadastrar; 681 | private javax.swing.JButton jBExcluir; 682 | private javax.swing.JButton jBNovo; 683 | private javax.swing.JButton jBPesquisar; 684 | private javax.swing.JButton jBSair; 685 | private javax.swing.JLabel jLabel1; 686 | private javax.swing.JLabel jLabel10; 687 | private javax.swing.JLabel jLabel2; 688 | private javax.swing.JLabel jLabel3; 689 | private javax.swing.JLabel jLabel4; 690 | private javax.swing.JLabel jLabel5; 691 | private javax.swing.JLabel jLabel6; 692 | private javax.swing.JLabel jLabel7; 693 | private javax.swing.JLabel jLabel8; 694 | private javax.swing.JLabel jLabel9; 695 | private javax.swing.JPanel jPanel1; 696 | private javax.swing.JPanel jPanel2; 697 | private javax.swing.JPanel jPanel3; 698 | private javax.swing.JScrollPane jScrollPane1; 699 | private javax.swing.JTextField jT0Id; 700 | private javax.swing.JTextField jT1Nome; 701 | private javax.swing.JTextField jT2DataAno; 702 | private javax.swing.JTextField jT2DataDia; 703 | private javax.swing.JTextField jT2DataMes; 704 | private javax.swing.JTextField jT3Sexo; 705 | private javax.swing.JTextField jT4Cpf; 706 | private javax.swing.JTextField jT5Endereco; 707 | private javax.swing.JTextField jT6Fone; 708 | private javax.swing.JTextField jTPesquisar; 709 | private javax.swing.JTable jTablePesquisa; 710 | // End of variables declaration//GEN-END:variables 711 | 712 | } 713 | --------------------------------------------------------------------------------